|
Dan, As always, it depends. YMMV. Use what works for you. I'll make a few points and you can decide as you like. Letting the optimizer make the chioce is not always the best plan. The optimizer is often set to timeout after a period of time if it hasn't yet finished its analysis. The engine then proceeds with the current best choice, regardless of other "better" methods. Opinion: I like the formal syntax because you are distinctly telling the optimizer what you intend. I believe the optimizer can discard many of the evaluations it might have to do with a simple join statement. Eric DeLong Sally Beauty Company MIS-Project Manager (BSG) 940-898-7863 or ext. 1863 -----Original Message----- From: Dan [mailto:dbcemid@xxxxxxxxx] Sent: Friday, March 28, 2003 9:21 AM To: Midrange Systems Technical Discussion Subject: Re: next baby step in SQL: start using join Ok, guys, I'm seeing two schools of thought here. Dave & Gord say to let the WHERE do the "joining", whereas Rick suggests using JOIN and taking care of file placement in the join. Gord also mentions that using WHERE will cause the query optimizer to determine the best path. I spruced up Rick's example and came up with: Select All T01.JOBNUM, T01.REVNUM, T01.PHSCD, T01.CCPNUM, T01.CCPAMT, T02.CSTTYP From PCPESTCCP T01 join PCPJOBHDR T03 on T01.JOBNUM = T03.JOBNUM join PCPTBLCCP T02 on T03.CMPNUM = T02.CMPNUM and T01.CCPTYP = T02.TBLID and T01.CCPNUM = T02.CCPNUM Where T01.JOBNUM = '3ACM0170' and T02.CSTTYP = 'C' I suppose it gets into personal opinion, but, in this example anyway, I find using the JOIN makes it more apparent that you are joining files and how you are joining them. (vs. using WHERE to do the join.) Comments and advice are welcome & appreciated. - Dan --- "Smith, Dave" <DSmith@xxxxxxxxx> wrote: > Dan: > > The join using the WHERE is no different than the join using the JOIN. (A rose by any other > name....) Within my embedded SQL, I like to use the JOIN operator because it's consistent with > the LEFT OUTER JOIN and EXCEPTION JOIN operators. I must say the more SQL I learn, the more I > love it! > > David Smith > dsmith@xxxxxxxxx __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx 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-2024 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.