× 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.



This is how Query/400 does joins - with the WHERE clause. And how we all did this before AS/400 gave us the JOIN clause. The first 4 tests in the WHERE clause are your JOIN specs - go back to your Query/400 definition in the file specification and compare to those.

RTVQMQRY does not handle type 2 or 3 joins from Query/400 - makes then all type 1 - so be sure to check if you have those in the query definition.

Basically, the first 4 tests are put into the ON clause of the JOIN, the last 2 stay in the WHERE clause.

If you have type 2 or 3, you need to use a LEFT OUTER join or an EXCEPTION join.

HTH

Vern

At 01:04 PM 3/27/2003 -0800, you wrote:
I'm somewhat of an experienced simple user of SQL, i.e., never done any joins.

I am now have what appears to be a perfect opportunity to use SQL join to greatly simplify my
coding. Knowing that one can use Retrieve Query Mgmt Query (RTVQMQRY) to take a *QRYDFN and
generate the SQL via ALWQRYDFN(*YES), I use WRKQRY to set up the query, get it working the way I
want it to, save the *QRYDFN, and use RTVQMQRY to generate the SQL.


So, I am surprised to see that the generated SQL doesn't have any Join clauses (?) but, instead,
does the join via WHERE, i.e.:
FROM PQPROD/PESTCCP T01,
PQPROD/PTBLCCP T02,
PQPROD/PJOBHDR T03
WHERE T03.CMPNUM = T02.CMPNUM
AND T01.CCPTYP = T02.TBLID
AND T01.CCPNUM = T02.CCPNUM
AND T01.JOBNUM = T03.JOBNUM
AND( T01.JOBNUM = 'TACM0170'
AND T02.CSTTYP = 'C')


The join in WRKQRY



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.