Hi Mike,

Is this what you mean?

EMPLOYEE
empid
supid

MENU
empid
email
userid

SELECT e.empid, m1.userid, m1.email, m2.supuserid, m2.supemail
FROM EMPLOYEE e
JOIN MENU m1 on e.empid = m1.empid
JOIN MENU m2 on e.supid = m2.empid

*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
pdow@xxxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxxx> /

Mike Cunningham wrote:
I have a need to join two files as if they were three. We have an employee file that has an employee ID and an employees supervisors smeployee ID. We have a second file that is part of our menu system that has an employees employee id and their system userid and e-mail address. I want to create a single join file that has the employee's userid and e-mail and the supervisors userid and e-mail.

I can't do this
R EMFLE JFILE(UTPUNAME LWPEMFLE UTPUNAME)
J JOIN(1 2)
JFLD(USS# LWPCTID)
J JOIN(2 3)
JFLD(LWEMPS USS#)
The create fails saying there are two many "J" specs. Acts like the second UTPUNAME is being ignored.

So I tried creating an alias pointing to UTPUNAME named UTAUNAME and tried this..

R EMFLE JFILE(UTPUNAME LWPEMFLE UTAUNAME)

J JOIN(1 2)
JFLD(USS# LWPCTID)
J JOIN(2 3)
JFLD(LWEMPS USS#)
This create failed because it said DDM file UTAUNAME could not be accessed at remote location *LOCAL. We do have a *LOCAL defined under WRKRDBDIRE that net.data needed that points to the local system name. (Interesting that the SQL CREATE ALIAS used DDM files).

Can anyone offer any suggestions on how to fix the DDM issue or how to setup the kind of join I want to create?

p.s. The app that needs this is doing a JDBC connection from a PC and using SQL commands to access the data and could do two SELECT commands but I would prefer to keep the logic for how this join is defined and the fields it contains and what the application sees on the iSeries side and not in the PC application.

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