title: hive Expression Not In Group By Key
body: <p>I create a table in HIVE.
  It has the following columns:</p>
  
  <pre><code>id bigint, rank bigint, date string
  </code></pre>
  
  <p>I want to get avg(rank) per month. I can use this command. It works.</p>
  
  <pre><code>select a.lens_id, avg(a.rank)
  from tableA a
  group by a.lens_id, year(a.date_saved), month(a.date_saved); 
  </code></pre>
  
  <p>However, I also want to get date information. I use this command:</p>
  
  <pre><code>select a.lens_id, avg(a.rank), a.date_saved
  from lensrank_archive a
  group by a.lens_id, year(a.date_saved), month(a.date_saved);
  </code></pre>
  
  <p>It complains: <code>Expression Not In Group By Key</code></p>