|
Reeve, I think this will work: select account, name, M1.sales, M2.service from orders inner join master M1 on empno=M1.sales# innner join master M2 on empno=M2.service# (I think the M1 and M2 are called file "aliases", but I'm not sure.) Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> writes: >I'm trying to join to a master file two times in the same record (once >for >the sale rep's name; one for the tech's name). The application will be >embedded SQL in an ILE RPG program. > >I can solve the problem by creating a logical with renamed fields :( but >I'm >sure I've seen a way that doesn't require a external solution. > >This way (below) works but SQL tells me my subquery has an unqualified >correlation. I don't know if that means the Programming Police will be >after me or if it's an indication of a potential performance problem. I >could write a stored procedure but I think that's overkill. > >select account,name, >(select sales from master where empno=sales#), >(select service from master where empno=service#) from orders > >thanks--- Mike Naughton Senior Programmer/Analyst Judd Wire, Inc. 124 Turnpike Road Turners Falls, MA 01376 413-863-4357 x444 mnaughton@xxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.