On Thu, 22 Apr 2004 10:21:43 +0200, bdjensen wrote:
Hello!
You can do it in Oracle, but how to do that in MS SQL.
I don't whish to write
select * from a where field1fromA=1 and field2fromA=2
because i want to generate (1,1) from a subselect...
Thanks
Bjoern
Hi Bjoern,
You can change the IN to an EXISTS:
Illegal in SQL Server:
SELECT something
FROM a
WHERE (field1, field2) IN
(SELECT col1, col2
FROM othertable
WHERE whatever = something)
Equivalent, legal in SQL Server:
SELECT something
FROM a
WHERE EXISTS
(SELECT *
FROM othertable
WHERE whatever = something
AND col1 = a.field1
AND col2 = a.field2)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)