Maybe UNION is what you want
Select DEDEMP from DEDBAL
UNION
select INCEMP from INCBAL
and as the employee number is present on PRMAST, then you can ignore PRMAST
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
"Dennis Lovelady"
<iseries@lovelady
.com> To
Sent by: "'Midrange Systems Technical
midrange-l-bounce Discussion'"
s@xxxxxxxxxxxx <midrange-l@xxxxxxxxxxxx>
cc
06/10/2010 04:00 Subject
PM SQL Join - all rows from any table
for employee
Please respond to
Midrange Systems
Technical
Discussion
<midrange-l@midra
nge.com>
We have three tables: DEDBAL, INCBAL, and PRMAST.
Each of these contains an employee number (DEDEMP, INCEMP, PREMP). We want
to produce output where an employee is represented in either DEDBAL and
INCBAL or both. (For the sake of argument, we can assume that PRMAST is
present for each employee).
I've tried various types of joins (LEFT OUTER, FULL, et cetera) and have
pored through the archives and GOOGLE and come up empty on a means of doing
this exactly right. (I'm convinced this is a common issue; so my issue is
probably my choice of search words - usually resulting in too many hits).
Would some kind soul mind directing me to guidelines on how to write the
JOIN for this challenge?
Thanks!
Dennis E. Lovelady
AIM/Skype: delovelady MSN: fastcounter@xxxxxxxxxxxx
<
http://www.linkedin.com/in/dennislovelady>
www.linkedin.com/in/dennislovelady --
I am at one with my duality.
--
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.