|
Here is an SQL that works to start with.
WITH temp_pstruc (RELVL, ITEM, QTY) AS ( SELECT 0, PINBR, 0 FROM AMFLIBP/PSTRUC where pinbr like '%5022322%'
UNION ALL SELECT a.relvl + 1, b.cinbr, b.qtypr FROM temp_pstruc AS a join amflibp/pstruc AS b on ITEM = b.pinbr ) SELECT DISTINCT * FROM temp_pstruc
Here is the resulting data, which is valid based on my source
RELVL ITEM QTY
0 5022322 .000
1 7022322 1.000
1 7022322.1 1.000
1 10566.16 2.000
2 7022322.2 1.000
2 9022322 1.000
2 7022322.3 1.000
2 9022322.1 1.000
It is not quite in the order that I want though. Does anyone know how to get it to order like this:
RELVL ITEM QTY
0 5022322 .000
1 7022322 1.000
2 7022322.2 1.000
2 9022322 1.000
1 7022322.1 1.000
2 7022322.3 1.000
2 9022322.1 1.000
1 10566.16 2.000
***DISCLAIMER - Use this SQL at your own risk. I am not responsible if your recursion loops indefinitely.***
CRPence wrote:
My browser is unavailable, but what about searching the web for examples of recursive SQL queries to do that? I seem to recall running across one or two when trying to learn about recursive queries. SQL is available on all IBM i & i5/OS; later releases support recursive queries [with restriction to the SQL Query Engine; SQE, which means query of the physical file(s) only]. HTH.
Bob Voltz wrote:
<<SNIP>>
I am looking for a program that will do a BOM Explosion and produce results that match MAPICS Inquiry AMEC72.
It needs to output to a file.
Someone did send me a program that will blow through the BOM, but the quantities don't match the MAPICS Inquiry AMEC72.
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.