Ha!
This works!! What I've been doing is the following:
SELECT *
FROM A
WHERE NOT EXISTS(SELECT * FROM A,B WHERE B.ssn=A.ssn AND B.orderid=A.orderid)
Sorry, I am new to SQL so trying to understand why this did not work.
Thanks so much, PHV!!!
Thanks PHV, however what I am trying to find is the following.
A
-ssn
-orderid
B
-ssn
orderid
I want the Customers(SSN) in A whose order(orderid) is not in B. SSN is unique but order id is not so customers could have the same orderid.
Thanks
I have two TABLES [A] and [B] with these attributes.
A
-ssn
-id1
B
-ssn
id2
I want to find all SSN from A whose id1 does not exist in id2. I can find all ssn in A not in SSN B.
Select * from A where ssn not in(select ssn from A, B where a.ssn=b.ssn)
but how do I get all the SSN and the ID1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.