October 29, 2009 at 4:56 am
Hello,
i got a question with a subquery.
select champ1, champ2
from table
where champ1, champ2 in (select champ1, champ2 from table2)
sql 2005 server
Thanks
October 29, 2009 at 5:26 am
select champ1, champ2
from table t1
where exists (select 1
from table2 t2
Where t2.Champ1 = t1.champ1
AND t2.champ2 = t1.champ2)
Is this what you need? I think yours is pl-sql, no?
---------------------------------------------------------------------------------
October 29, 2009 at 7:38 am
Nabha has provided what I would consider to be the best solution. In SQL Server you cannot evaluate multiple columns using column in (Select columnA, ColumnB from Table). The WHERE EXISTS that Nabha provides is the method to do that. You could also write it as an INNER JOIN.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply