title: Can a HIVE SELECT combine GROUP BY and ORDER BY?
body: <p>I'm doing some relatively simple queries in Hive and cannot seem to combine <code>GROUP BY</code> and <code>ORDER BY</code> in a single statement. I have no problem doing a select into a temporary table of the <code>GROUP BY</code> query and then doing a select on that table with an <code>ORDER BY</code>, but I can't combine them together.</p>
  
  <p>For example, I have a table <code>a</code> and can execute this query:</p>
  
  <pre><code>SELECT place,count(*),sum(weight) from a group by place;
  </code></pre>
  
  <p>And I can execute this query:</p>
  
  <pre><code>create temporary table result (place string,count int,sumweight int);
  insert overwrite table result 
        select place,count(*),sum(weight) from a group by place;
  select * from result order by place;
  </code></pre>
  
  <p>But if I try this query:</p>
  
  <pre><code>SELECT place,count(*),sum(weight) from a group by place order by place;
  </code></pre>
  
  <p>I get this error:</p>
  
  <p>Error: Error while compiling statement: FAILED: ParseException line 1:45 mismatched input '' expecting \' near '_c0' in character string literal (state=42000,code=40000)</p>