|
Well, it will depend a little on the structure of b and c, why are the codes in 2 different files? Is there any overlap between b and c or is it just the case that some codes are in b and some codes are in c? If there is no overlap between b and c then you can do. SELECT a.RECCODE, a.BANKCODE, a.BANKNAME, case when c.recname is null then b.recname when b.recname is null then c.recname else 'error no recname found' end as recname FROM a left outer join b on a.reccode = b.reccode left outer join c on a.reccode = c.reccode Chris -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Muralidhar Narayana Sent: Monday, April 25, 2005 11:58 AM To: rpg400-l@xxxxxxxxxxxx Subject: help with Sql I have a file A , it has got 3 columns Reccode bankcode bankname I have to create a file with Reccode, bankcode ,bankname and Recname. Recnames come from files B and C. I have files B and C which have many columns including Reccode and Recname... I have to get Recnames for all Reccodes present in my file A. Can some one help with Sql query? ------------------------------------------------------------------------ - -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-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.