title: Select from a Hive Table where date less than max date
body: <p>I'm trying to select * from a Hive table where a date column called TRANS_DATE say is >= than the 365 days before the maximum TRANS_DATE. </p>
  
  <p>Below is the query I've tried so far:</p>
  
  <pre><code>select * from TABLE
  where (TRANS_DATE &gt; DATE_SUB(max(TRANS_DATE), 365)) and 
          (TRANS_DATE &lt; max(TRANS_DATE));
  </code></pre>
  
  <p>Below is the error I have gotten:
  "Error while compiling statement: FAILED: SemanticException [Error 10128]: Line 2:28 Not yet supported place for UDAF 'max'"</p>
  
  <p>An example of the date format is: "2006-05-30 00:00:00.0"</p>
  
  <p>The query is to be to read data from a hive table into Qlikview so ideally I'd like not to define variables before hand and would prefer to do the select dynamically. Apologies if any of this is daft as I'm new to Hive.</p>