Just do this:
Select A.C1USER, B.VENDOR, B.VENDNAME From EDIPFCONT1 A Join VENDORFL00
B On A.C1VEND = B.VENDOR Where A.C1VNDEDI = ' + @Tic + @Yes + @Tic + ')
'
Order By VENDNAME
John Arnold
(301) 354-2939
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of RWMunday
Sent: Tuesday, January 06, 2009 6:51 AM
To: Midrange Systems Technical Discussion
Subject: SQL Join
Greetings from sunny Florida.
I have an embedded SQL statement in an RPG /Free program which gets the
value of two fields in one file. The records in this file (VENDORFL00)
are
dependent upon the value of a field in a second file (EDIPFCONT1):
// Assemble SQL Statement
QQSQL = 'Select VENDOR, VENDNAME From VENDORFL00 ' + // Select Fields
'Where VENDNAME >= ' + @Tic + @ArgName + @Tic +
'And VENDOR In (Select A.C1VEND From EDIPFCONT1 A Join VENDORFL00 B -
On A.C1VEND = B.VENDOR -
Where A.C1VNDEDI = ' + @Tic + @Yes + @Tic + ') ' + // Select EDI
Vendors
From Contact
'Order By VENDNAME ' + For_Read; // Order By
Vendor
Name
My requirements have changed and I need to capture the value of a field
(C1USER) in the second file (EDIPFCONT1). I will use these three fields
to
load a subfile. Until I solve this, I'm having to chain to the second
file
as I load each subfile record to get the User field value. This is most
inefficient. I'm checking that file for the condition, but now I need a
value from it.
How do I compose a Join or Union to get VENDOR and VENDNAME from
VENDORFL00
and C1USER from EDIPFCONT1? They are joined by the Vendor Number. I
have
tried various combinations without success both in the program and
interactively.
If you can help, please e-mail me directly at RMunday@xxxxxxxxxxxxxx
Our
new CEO shut down access to online e-mail so I have been unable to view
or
access the Midrange Lists. It hurts to be without this resource.
Thanks,
Robert Munday
Munday Software Consultants
Montgomery, AL
on assignment in Jacksonville, FL
soon to be somewhere else...
As an Amazon Associate we earn from qualifying purchases.