title: Hive: SELECT AS and GROUP BY
body: <p>I have a Hive Query like </p>
  
  <pre><code>SELECT Year, Month, Day, Hours, Minutes,
             cast((cast(Seconds as int)/15) as int)*15
  AS secondMod, Count(*) AS PerCount FROM LoggerTable 
   GROUP BY Year, Month, Day, Hours, Minutes, secondMod 
  ORDER BY PerCount;
  </code></pre>
  
  <p>the above query fails with an error</p>
  
  <blockquote>
    <p>FAILED: Error in semantic analysis: line 1:175 Invalid Table Alias or Column Reference secondMod</p>
  </blockquote>
  
  <p>'LoggerTable' is a Hive Table with all columns of string type.</p>
  
  <p>Any workaround for this issue?</p>