title: DESCRIPTION' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1114048/column-is-invalid-in-the-select-list-because-it-is-not-contained-in-either-an-ag">Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause</a>  </p>
  </blockquote>
  
  
  
  <p>I am  a newbie in SQL querying; I'm getting this error:</p>
  
  <blockquote>
    <p>"DESCRIPTION' is invalid in the select list because it is not
    contained in either an aggregate function or the GROUP BY clause"</p>
  </blockquote>
  
  <p>I can't find the right aggregate function. I need something like <code>unique(DESCRIPTION)</code> in my select statement </p>
  
  <p>My description column is unique varchar values, any idea?</p>
  
  <pre><code>INSERT INTO myTable2 (ID,INDEX,STATUS,DESCRIPTION,TS)
  SELECT ID,min(INDEX),STATUS,DESCRIPTION,min(TS) from myTable2 t1top
  WHERE (EXISTS(
          SELECT * FROM myTable1 WHERE ID=t1top.ID AND STATUS='Completed' )) 
  GROUP BY ID, STATUS
  ORDER BY ID  DESC, STATUS DESC
  </code></pre>