composite where conditions

Last Post 16 Nov 2007 05:42 AM by roma. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
roma
New Member
New Member

--
15 Nov 2007 11:49 AM
Hi ,
i hane 2 tables:
Set_L: OID , zoneID, pace
1 A AA
2 B BB
2 C CC
2 D DD
3 E EE

and Set_N: OID , zoneID, Location
1 A l1
2 B l2
2 C l3
3 E l5

I try to fined all combinations (OID , zoneID) from Set_L which is not exist into Set_Z, but my select return me incorret resutl.
My result should bring me only ( 2 , D , DD) line



SELECT a.*
FROM Set_L a
WHERE (a.OID, a.zoneID) NOT IN (SELECT OID, zoneID FROM Set_N)

where is my problem?

Thank you

timcronin
New Member
New Member

--
15 Nov 2007 12:55 PM
How about

SELECT a.*
FROM Set_L a
WHERE (a.OID + a.zoneID) NOT IN (SELECT (OID + zoneID) FROM Set_N)

If you need convert the fields to varchar 1st, if not needed this should work
roma
New Member
New Member

--
16 Nov 2007 05:42 AM
Thank you all,
it is work
You are not authorized to post a reply.

Acceptable Use Policy