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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left Outer Join Syntax w/ 3 Tables?

Status
Not open for further replies.

SeaninSeattle

IS-IT--Management
Sep 17, 2001
53
US
I have three tables I'm trying to use in a query (to pull up a list of RECNUM and PO Numbers, but not those in a resricted table SEANR), two of which I need to do a left outer joint on. My script:


select PO20301.RECNUM, PO20302.PONUMWRK
from PO20301 LEFT OUTER JOIN PO20302
on PO20301.RECNUM = PO20302.RECNUM
and PO20301.RECNUM = SEAN2.RECNUM
and PO20302.PONUMWRK not in
(select PONUMWRK from SEANR)


is not complete because I need to add the table "SEANR" to it to provide a list of those PO numbers not to include in the selection. I thought I could just add it by adding ",SEANR" to the end of the second line - but I was wrong.

Does anyone know what the correct syntax should look like?

Thanks for your help!

//sse Sean Engle
Admin/DirIS
ssengle@bswusa.com
 
Sorry -

Actually, I need to join it also to SEAN2 (which has the select RECNUMs in it that I want to pull on - minus the SEANR table...

Thanks!

//sse Sean Engle
Admin/DirIS
ssengle@bswusa.com
 
I'm not sure that I'm that clear I want you need, but perhaps you could try this and let us know if it works for you.

Select PO20301.RECNUM, PO20302.PONUMWRK
From PO20301
LEFT OUTER JOIN PO20302
ON PO20301.RECNUM = PO20302.RECNUM
LEFT OUTER JOIN SEAN2
ON PO20301.RECNUM = SEAN2.RECNUM
WHERE PO20302.PONUMWRK not in
(Select PONUMWRK from SEANR)
 
Thanks for your reply - I'll check this out fully tomorrow - but it looks good (from what I see in Query Manager). Thanks for your help!

//sse Sean Engle
Admin/DirIS
ssengle@bswusa.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top