RTVQMQRY command will convert your query to SQL:

RTVQMQRY QMQRY(the-query) SRCFILE(source-file) ALWQRYDFN(*YES)

You will find the SQL version of your query in source-file. Here's an example:

H QM4 05 Q 01 E V W E R 01 03 07/09/27 16:36
V 1001 050 Extract xxxxxxxx s ssss sss sssss sss
V 5001 004 *HEX
SELECT
ALL E.MEMSID, T.MTMSFL, T.MTMFLB, 'XXXX' AS COMP, 'S' AS MXXION
FROM LIBX/RBCSH S,
LIBX/RBCMT T,
LIBX/RBCME E
WHERE SHMSGT = MTMSGT
AND MTMSGT = MEMSGT
AND( SHSUPR = '1'
AND SHMSGT <> ' ')


On 9/27/07, donna lester <donna_lester_ny@xxxxxxxxx> wrote:
I have a query between two files FILE1, FILE2

type of join : 1 Matched records.
how to join : T01.SBKRNM EQ T02.SRCDTA
SELECT RECORDS: T01.SQCDE LIST 'SA' 'SB' 'SD' 'SG' 'SH'

the count of records is 465,962

I have written equivalent SQL(I dont think its correct bcoz count is differing) as I need SQL conversion of above query.

SELECT COUNT(*) FROM FILE1 A JOIN
FILE2 B ON A.SBKRNM = B.SRCDTA
AND A.SQCDE IN('SA', 'SB', 'SD', 'SG', 'SH')

Count comes 299,428

I tried right outer join as below but count count doesnt match.
SELECT COUNT(*) FROM FILE1 A RIGHT OUTER JOIN
FILE23 B ON A.SBKRNM = B.SRCDTA
AND A.SQCDE IN('SA', 'SB', 'SD', 'SG', 'SH')

Can some one advise what could be the correct SQL equivalent of my query. Sorry for my ignorance of the understanding with unions if it is something wrong with my SQL.


Thanks,

Donna.

---------------------------------
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!
--
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 ...

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.