Select A.*,COALESCE(b.DivisionCode, ' '),COALESCE(C.Description,' ')
FROM file1 A left outer join file2 b ON A.userProfile = B.userProfile
Left outer join file3 ON b.DivisionCode = c.DivisionCode

Hth, Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com


-----Original Message-----
Subject: How to create such query ?

Hi

I have three files:
File1 - with all user profiles (outfile from DSPUSRPRF)
File2 - with the same user profile (but not every profile from File1 has
record in File2), this
file2 has also additional field - "code of divison" i.e. AC
File3 - where code are explain i.e. AC - Accounting (all codes from File2
has explanation in File3)

And now I would like to get report where I receive ALL profile from File1
with name of Division (if
profile doesn't exist in File2 should have BLANK as division)
But I received only this which exist in File2 or nothing. How to connect
these three files? Which
subquery will be correct?


This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].