Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2efeb04

Browse files
committed
Doc: fix example of recursive query.
Compute total number of sub-parts correctly, per [email protected] Simon Riggs Discussion: https://postgr.es/m/[email protected]
1 parent e1ea6f3 commit 2efeb04

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/src/sgml/queries.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,7 @@ SELECT sum(n) FROM t;
21292129
WITH RECURSIVE included_parts(sub_part, part, quantity) AS (
21302130
SELECT sub_part, part, quantity FROM parts WHERE part = 'our_product'
21312131
UNION ALL
2132-
SELECT p.sub_part, p.part, p.quantity
2132+
SELECT p.sub_part, p.part, p.quantity * pr.quantity
21332133
FROM included_parts pr, parts p
21342134
WHERE p.part = pr.sub_part
21352135
)

0 commit comments

Comments
 (0)