开发者

Multiple subqueries - SQL Server telling me to use EXISTS?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜