× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi Sheri
Off the top of my head (in otherwords - not validated)
And not knowing the field names of the 2 files
I think you may want to look at UNION
With Unionfile as (Select Voucher1 as Vchr, Vendor1 as Vndr, Invoice1 as
INV#, PostDate1 as Postdte
from APOHD
union
Select Voucher2 as Vchr, Vendor2 as Vndr, Invoice2 as INV#, PostDate2 as
Postdte from APHHD
select Vchr, Vndr, INV#, Postdte from Unionfile where Vchr = #####



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
"If you're going through Hell, keep going" - Winston Churchill




"Rowe, Sheri"
<srowe@xxxxxxxxx>
Sent by: To
rpg400-l-bounces@ <RPG400-L@xxxxxxxxxxxx>
midrange.com cc

Subject
02/26/2008 04:32 can this be done with SQL - a
PM record is one file or the other


Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>






Hi iSeries Guru's,



Can anyone tell me if I can do this with SQL and if so how?



I have a Vendor File APOHD and a Vendor History file APHHD. A voucher
will either be in one file or the other, not both, as once a voucher is
closed it will be in the History file. Both files contain the same
information, but have different field names.



A user wants to get the Voucher, Vendor#, Invoice# and Posting Date of a
given voucher (it needs to be a variable which I can pass), but it will
be in only one file or the other. I can't figure out how to do a
'non join' on the files.



I know I could do this with 2 separate SQL's, but was curious if it's
possible to do it with one.



I want a result that looks like this, regardless of which file has the
voucher.



Voucher Vendor Invoice Posting Date

79993 1234 456789 080228



Thanks in advance for your help!



Sheri



--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.