ABerkowicz
MIS
Hi - I have 2 tables, a header and a detail table. What I need to do is be able to select the header contracts when the detail table contains ALL the records in a list value. So, for example I have the following:
header table
ContractNumber
100
200
300
400
detail table
ContractNumber, ItemNumber
100,ABC1
100,TGS5
100,TEST4
100,12-222
200,ABC5
200,ABC1
200,TGS5
300,ABC1
300,TGS5
300,TEST4
300,12-222
300,Test5
400,ABC1
400,TGS5
400,TEST4
400,787878
I need to see the contractnumbers that have all of the following items:
ABC1
TGS5
TEST4
12-222
The result would be contracts 100 & 300 only
I cannot use in as it would give me all of the contracts - Ideas? Thanks!
header table
ContractNumber
100
200
300
400
detail table
ContractNumber, ItemNumber
100,ABC1
100,TGS5
100,TEST4
100,12-222
200,ABC5
200,ABC1
200,TGS5
300,ABC1
300,TGS5
300,TEST4
300,12-222
300,Test5
400,ABC1
400,TGS5
400,TEST4
400,787878
I need to see the contractnumbers that have all of the following items:
ABC1
TGS5
TEST4
12-222
The result would be contracts 100 & 300 only
I cannot use in as it would give me all of the contracts - Ideas? Thanks!