invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
sql, sql-server
Solution
The error message is self-explanatory - you need to use an aggregate function:
SELECT
[finalConc],
MIN([rowid]) AS minRowId,
MAX([rowid]) AS maxRowId
FROM ...
Problem
``` use qcvalues_test go select [finalConc] ,[rowid] from qvalues where rowid in (select rowid from batchinfo where instrument = 'TF1') and name='qc1' and compound='etg' group by finalConc having COUNT(rowid)=2 ``` why am i getting this error Msg 8120, Level 16, State 1, Line 3 Column 'qvalues.rowid' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.