开发者

invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

开发者 https://www.devze.com 2023-01-29 08:06 出处:网络
use qcvalues_test go select [finalConc] ,[rowid] from qvalues where rowid in (select rowid from batchinfo where instrument = \'TF1\')
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开发者_JAVA百科
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.


The error message is self-explanatory - you need to use an aggregate function:

SELECT
    [finalConc],
    MIN([rowid]) AS minRowId,
    MAX([rowid]) AS maxRowId
FROM ...


Hi herrow To solve this problem you need to replace select [finalConc] ,[rowid] from qvalues with select [finalConc] ,Count([rowid]) from qvalues

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号