|
Thanks Rob - I'll give this a shot. It seems too easy. Maybe I need a vacation. Alan Shore NBTY, Inc (631) 244-2000 ext. 5019 AShore@xxxxxxxx rpg400-l-bounces@xxxxxxxxxxxx wrote on 10/03/2006 11:47:41 AM:
create table FileC (ordernumber, itemnumber, quantity, catagory, subcategory, bCategory, bSubcategory) as ( select a.*, coalesce(b.category,0), coalesce(b.subcategory,0) from filea a left outer join fileb b on a.itemnumber=b.itemnumber) Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Alan Shore <AlanShore@xxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 10/03/2006 11:19 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject creating a file via SQL Morning all I am giving myself a headache in trying to solve a problem with SQL I've tried looking through the archives, but I am not really too sure
what
I am looking for. Anyway, if anyone can help me, The problem is as follows:- I have 2 files, in their simplistic form FileA Order number Item number Quantity Category Sub category FileB Item number Category Sub category In FileB, Item number is NOT unique. Item number within Category IS unique. For example Item number 000001 can be in Category 0001 AND in Category 0094 What I want to happen is that for an order that contains item number 000001, I want a file (FileC) that contains 2 records from the original
1.
One record with Category 0001 and the other record with category 0094. FileA to FileC is a one to many ratio. The other problem is if the item number does NOT exist on FileB, FileC should contain one record with 0 category. I think that's it. If anyone can help, or point me in the right direction, I would be VERY grateful Thanks in advance Alan Shore NBTY, Inc (631) 244-2000 ext. 5019 AShore@xxxxxxxx -- 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. -- 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 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.