Link to home
Start Free TrialLog in
Avatar of gvamsimba
gvamsimbaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL Help Needed

Table A

   custid   orderid
     101      5418
     102      7408
     102      5408
     103      9547
 

 Table B

Orderid
5418
9547
5408

I have 2 tables. From table A I only need to select those custid where all the orderid's are present in
table B.

in this case, I only need to select custid 101 and 103 as one of the orderid (7408) is not present in tablel B.

can anyone please give me that SQL ? I am using IBM DB2 Database.

Many Thanks
Avatar of gvamsimba
gvamsimba
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

in this case, the query should only select custid 101 and 103 as one of the orderid (7408) for custid 102 is not present in tablel B.
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Fantastic Ste5an. it worked like a charm .

Many Thanks