Quantcast
Channel: Spiceworks Community
Viewing all articles
Browse latest Browse all 42

DB2 Recursion Bill of Materials in SSRS issue with joining add'l tables

$
0
0

Well - I still have a logic error on my totals - and it's running excruciatingly slow... but, I think I'm over the hump for now.

Explaining it here and having Drew ask a question helped a lot.

Here's the current version I'm working with - it's not working on the inventory totals - but is working from a no errors getting thrown by DB2 or SSRS.

Thank you!

WITH RPL (BPROD, BCHLD, BQREQ, LOPB, LIALOC) AS
(
	SELECT ROOT.BPROD, ROOT.BCHLD, ROOT.BQREQ, ILI.LOPB, ILI.LIALOC
	FROM BPCSFILE64.MBM ROOT, BPCSFILE64.ILI ILI
	WHERE ROOT.BPROD = ?
	AND ROOT.BCHLD = ILI.LPROD
UNION ALL
	SELECT PARENT.BPROD, CHILD.BCHLD, PARENT.BQREQ*CHILD.BQREQ, ILI.LOPB, ILI.LIALOC
	FROM RPL PARENT, BPCSFILE64.MBM CHILD, BPCSFILE64.ILI ILI
	WHERE PARENT.BCHLD = CHILD.BPROD
	AND CHILD.BCHLD = ILI.LPROD
)
	SELECT BPROD, BCHLD,
	(SUM(BQREQ) * ?) AS "Total QTY Used",
	SUM(LOPB) AS "Total Opening Balance",
	SUM(LIALOC) AS "Total Allocations"
	FROM RPL
	GROUP BY BPROD, BCHLD
	ORDER BY BPROD, BCHLD


Viewing all articles
Browse latest Browse all 42

Trending Articles