multiple column subquery
Posted on 2002-05-06
Can someone point me to an equivalent statement that will run on both
ms sql server 7 and 2000?
I am trying to select some rows from a table where two column entries
match some other criteria. The Oracle equivalent is at the bottom of
this message... In MS SQL Server Query Analyzer I am getting errors
SELECT table1.col1, table1.col2, table1.col3
WHERE (table1.num, table1.code) in
(SELECT table2.num, table2.code from table2
where table2.col4 = value
The error is: "Incorrect Syntax near ',' ", so it seems to not like
the comma in "where (table1,num, table2.code) in"
The important thing to remember is that each row in one table will have the same two values as a row in the other table.
.. I did not want to concatenate the rows as it seems to deliver different results.
Thanks for any assistance,
select (col1, col2, col3
where (num, code) in
(select num, code from table2 where col4 = value);