Doc: fix example of recursive query.
Compute total number of sub-parts correctly, per jason@banfelder.net Simon Riggs Discussion: https://postgr.es/m/166161184718.1235920.6304070286124217754@wrigleys.postgresql.org
This commit is contained in:
parent
805a397db4
commit
8c7fc86ca9
@ -2195,7 +2195,7 @@ SELECT sum(n) FROM t;
|
||||
WITH RECURSIVE included_parts(sub_part, part, quantity) AS (
|
||||
SELECT sub_part, part, quantity FROM parts WHERE part = 'our_product'
|
||||
UNION ALL
|
||||
SELECT p.sub_part, p.part, p.quantity
|
||||
SELECT p.sub_part, p.part, p.quantity * pr.quantity
|
||||
FROM included_parts pr, parts p
|
||||
WHERE p.part = pr.sub_part
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user