You can use RTVQMQRY to get the sql statement from the query object into a source file. I have done this quite a few times and found it to be a great learning tool.
HTH,
Joe
donna lester<donna_lester_ny@xxxxxxxxx> 09/27/07 4:14 PM >>>
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!
As an Amazon Associate we earn from qualifying purchases.