On Wed, 2008-09-24 at 16:02 +0200, Tomasz Skorża wrote:
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)

To get rows from File1 even in the absence of a row in File2, you want
what is called a "left join" ...

File1 left join2 File2 on File1.AC = File2.AC

To ensure that AC is blank in the absence of a row in File2, select ...

coalesce( File2.AC, ' ' ) AC

But I received only this which exist in File2 or nothing. How to connect these three files?

If File3 lacks an explanation for AC = blank, then the join from File3
must again be a *left* join.

HTH,
Terry.

Which
subquery will be correct?

--
Pozdrawiam

---------------------------------------------------------
Tomek


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