Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with query please 1

Status
Not open for further replies.

pkailas

Programmer
Jun 10, 2002
555
US
I have 2 tables BOLS and BOLINOB

BOLS has columns BOLNUM, ORDERNUM, INVNUM, LOCATION, SHIPTO1, SHIPDATE, ENTERDATE

BOLINOB has columns BOLNUM, ORDERNUM, INVNUM

I need to list the rows that ARE IN BOLS but NOT IN BOLINOB.

BOLNUM, ORDERNUM, INVNUM make the record unique. All 3 must be equal.

_______
I love small animals, especially with a good brown gravy....
 
select * from BOLS a
where not exists (select distinct b.BOLNUM, b.ORDERNUM,b.INVNUM from BOLS b join BOLINOB c on b.BOLNUM = c.BOLNUM and b.ORDERNUM = c.ORDERNUM
and b.INVNUM = c.INVNUM and b.BOLNUM = a.BOLNUM and b.ORDERNUM = a.ORDERNUM and b.INVNUM = a.INVNUM)

-Manjari
 
Thanks Manjari

I was overcomplicating it!

_______
I love small animals, especially with a good brown gravy....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top