Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 subquery issue

Author  Topic 

sardinka
Posting Yak Master

142 Posts

Posted - 2006-06-16 : 09:03:33
what am I doing incorrect? I have the following query...

select count(*)
FROM tablle1 s
Join table2 d....
Where s.Type IN (select Type from table3)
My sub query results returns more that 1 row and I am getting this error:
Only one expression can be specified in the select list when the subquery
is not introduced with EXISTS.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-16 : 09:17:42
can you post the entire query ?


KH

Go to Top of Page

sardinka
Posting Yak Master

142 Posts

Posted - 2006-06-16 : 10:15:28
select count(*)
FROM tablle1 s
Join table2 d
on s.column1=d.column1
Where s.Type IN (select Type from table3 where column1=d.column1)
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-16 : 10:17:57
Looks ok to me. Is the error message correct ?


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-16 : 10:21:41
You will get that error only if you used = in place of IN
Are you sure you get this error in sql server?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -