开发者

Multiple subqueries - SQL Server telling me to use EXISTS?

开发者 https://www.devze.com 2023-01-30 14:01 出处:网络
SE开发者_StackOverflowLECT SUBSTRING(datapath,1,5) FROM batchinfo WHERE rowid IN (select * from qvalues
SE开发者_StackOverflowLECT SUBSTRING(datapath,1,5) 
  FROM batchinfo 
 WHERE rowid IN (select * 
                   from qvalues 
                  where rowid in (select rowid 
                                    from batchinfo 
                                   where datapath like '%thc%'))
GROUP BY SUBSTRING(datapath, 1, 5)
  HAVING COUNT(*) > 1

I am getting this error

Msg 116, Level 16, State 1, Line 3 Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

Does anyone know what am I doing wrong?


...where rowid in (select * from qvalues... I'm guessing the * there is an issue. Specify the specific column from qvalues that rowid should be compared with (as you do in your second subselect); as it is, you're telling SQL Server to compare rowid to a complete row.

0

精彩评论

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