|
I think what you are looking for is a UNION. Select part1 as part, co1 as co, div1 as div, qty1 as qty >From myfile UNION ALL Select part2 as part, co2 as co, div2 as div, qty2 as qty >From myfile UNION ALL Select part3 as part, co3 as co, div3 as div, qty3 as qty >From myfile Order by part HTH, Charles Wilt -- iSeries Systems Administrator / Developer Mitsubishi Electric Automotive America ph: 513-573-4343 fax: 513-398-1121 > -----Original Message----- > From: rpg400-l-bounces@xxxxxxxxxxxx > [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of > steema@xxxxxxxxxxxxx > Sent: Wednesday, May 17, 2006 12:00 PM > To: RPG400-L@xxxxxxxxxxxx > Subject: Use SQL instead of RPG? > > HI I have another case here where I think SQL would be put to > better use. > Instead of building a work file in the RPG program. > > There are inventory records, specifically Repair records. The system > allows for one customer to have up to 5 items in repair. > > Now they want to see all of the items in repair, by model > number, sorted. > > It is possible to have the same model number per record. call > it part1, > part2, etc. it's really model number. > > The layout of the record is: > > PART #1 CO DIV QTY 1 PART #2 Part#3 etc.. > PH15R 1 1 PH5CW > PH15R 1 1 > PH15R 1 1 > PH15R 1 1 PH5CW > PH15R 1 1 PH5CW > > in this case, I want the PH5CW models to follow the PH15R. > > My thought is to build another work file that would then be > sorted. This > would be the second work file and RPG. So I was hoping perhaps this > could all be done in one SQL? The ultimate purpose is to then > show all the > model number by total in a subfile. > > Thanks, > Steve > > > > -- > 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.