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

multiple on clauses on outer join

Status
Not open for further replies.

tmartin99

MIS
Joined
Sep 14, 2001
Messages
9
Location
US
I have a problem, I need to be able to pull fields from a table and can have 2 possible id's that can refer to the same id field in the table but come from 2 different tables.
I need to be able to do syntax like the following:

LEFT OUTER JOIN
chrisprd.TASSIGNMENT A
on chrisprd.TREF_CLIENT.REFER_ID chrisprd.TASSIGNMENT.D_ENT_FOR_ID
or
on chrisprd.TCAS_CLIENT.CAS_ID = chrisprd.TASSIGNMENT.D_END_FOR_ID

Does anyone know how to perform this join?
 

You can't use an OR in the ON clause. Join the table twice.

LEFT JOIN chrisprd.TASSIGNMENT A
on chrisprd.TREF_CLIENT.REFER_ID = A.D_ENT_FOR_ID
LEFT JOIN chrisprd.TASSIGNMENT B
on chrisprd.TCAS_CLIENT.CAS_ID = B.D_END_FOR_ID Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
OK thanks, also I'm having a mind cramp, if one of the tables on the right side that I'm joining has multiple rows per id and I just want to select one of them how can I do that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top