|
If you want the records, even without a match, then substitute 'left join' for 'join' One of the joins is processed into a result set, then that result set is joined to the third table. I don't think it matters whether the FILE1, FILE2 join is done first, or the FILE2, FILE3 join. I also don't remember whether parentheses can control join order. Seems to me it didn't, once, but might in v5r1. Any takers on that? At 11:22 AM 4/3/02 -0500, you wrote: >1) It is F1A. > >2) I would want the records in both cases if there is no match. (Really >it would be whatever is easiest and performed the best, since for the most >part it would be unlikely for there not to be a match). > >Thanks > > > > > > rob@dekko.com > Sent > by: To: midrange-l@midrange.com > midrange-l-admin@m cc: > idrange.com Subject: Re: How do I > code this in a SQL SELECT? > > > 04/03/02 11:11 AM > Please respond to > midrange-l > > > > > > >This is a multipart message in MIME format. >-- >[ Picked text/plain from multipart/alternative ] >1) Is it F1A or F1C that equals F2A+F2B+F2C? >2) Joins. Do you want records from FILE1 if there is no match in FILE2? >Do you want records from FILE2 if there is no match in FILE3? Or does >your Referential Integrity definitions absolutely prevent this from >happening? (I doubt it, since you haven't normalized the F1? field to >match the fields in FILE2). > > >Rob Berendt >-- >"They that can give up essential liberty to obtain a little temporary >safety deserve neither liberty nor safety." >Benjamin Franklin > > > > >"Mark Phippard" <MarkP@softlanding.com> >Sent by: midrange-l-admin@midrange.com >04/03/2002 10:59 AM >Please respond to midrange-l > > > To: midrange-l@midrange.com > cc: > Fax to: > Subject: How do I code this in a SQL SELECT? > > >Consider the following three file definitions: > >FILE1 >F1A PK 10 >F1B 40 >F1C 10 > >FILE2 >F2A PK 4 >F2B PK 4 >F2C PK 2 >F2D 40 >F2E 1 >F2F 10 > >FILE3 >F3A PK 1 >F3B 10 >F3C 1 > >Files 1 and 2 could be joined by either combining the three key fields in >FILE2, or substringing the one field into the three subfields. > >Files 2 and 3 can be joined by fields F2E and F3A. > >Now, how can I do a SQL SELECT where I get the following fields: > >F1A >F1B >F1C >F2F >F3B > >Where F1C = "XYZ" and F3C = "Y' > >With all of the proper joins being honored, etc...? > >Thanks > >Mark > > > > >_______________________________________________ >This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing >list >To post a message email: MIDRANGE-L@midrange.com >To subscribe, unsubscribe, or change list options, >visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l >or email: MIDRANGE-L-request@midrange.com >Before posting, please take a moment to review the archives >at http://archive.midrange.com/midrange-l. > > > >_______________________________________________ >This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list >To post a message email: MIDRANGE-L@midrange.com >To subscribe, unsubscribe, or change list options, >visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l >or email: MIDRANGE-L-request@midrange.com >Before posting, please take a moment to review the archives >at http://archive.midrange.com/midrange-l. > > > > > >_______________________________________________ >This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list >To post a message email: MIDRANGE-L@midrange.com >To subscribe, unsubscribe, or change list options, >visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l >or email: MIDRANGE-L-request@midrange.com >Before posting, please take a moment to review the archives >at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.