Possible Duplicate:
Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
I am a newbie in SQL querying; I’m getting this error:
“DESCRIPTION’ is invalid in the select list because it is not
contained in either an aggregate function or the GROUP BY clause”
I can’t find the right aggregate function. I need something like unique(DESCRIPTION) in my select statement
My description column is unique varchar values, any idea?
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
Add DESCRIPTION to your GROUP BY list, it should work
but that doesn’t mean your query is correct – depends on what you want to achieve