× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Walden,

Very good point.  I forgot to mention that.  

Rick

-----Original Message-----
From: Walden H. Leverich III [mailto:WaldenL@xxxxxxxxxxxxxxx]
Sent: Friday, March 28, 2003 12:38 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: next baby step in SQL: start using join

>From: Chevalier, Rick [mailto:Rick.Chevalier@xxxxxxxxxxxxxxx]
> Any query that will make it to production I run against the
>analyzer to determine the best way to construct the statement.

I assume you run the test against production, or a reasonable copy thereof.
Table size has a huge impact on the "ideal" SQL statement. What works well
on 1000 rows isn't always what works well on 1,000,000.

-Walden

------------
Walden H Leverich III
President
Tech Software
(516) 627-3800 x11
(208) 692-3308 eFax
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)


-----Original Message-----
From: Chevalier, Rick [mailto:Rick.Chevalier@xxxxxxxxxxxxxxx]
Sent: Friday, March 28, 2003 12:05 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: next baby step in SQL: start using join


Dan,

As I understand the optimizer it starts with the WHERE clause and then
proceeds to the JOIN clause in determining what indexes, views, files, etc.
to use for the query.  I don't think it really makes a difference if the
join is done in the WHERE clause or the JOIN clause. 

There are several people here who join using the WHERE clause because that's
the way they learned.  It may also be easier to understand the WHERE as
opposed to the intricacies of JOIN because, IMO, it more easily relates to
the way we think of organizing the data.  IMHO the JOIN is more powerful and
flexible.  But, I learned SQL using JOIN so it is more natural for me.

If you are using the new iSeries Express (previously Client Access Express)
you can use the SQL analyzer in Ops Nav to check out your queries before
running them.  Any query that will make it to production I run against the
analyzer to determine the best way to construct the statement.  I have
compared using JOIN and WHERE for the same statement and the analyzer
returned the same results for both queries.

Just my thoughts,

Rick

-----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.
_______________________________________________
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.
_______________________________________________
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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.