|
You mean all descendants of a node / transitive closure? WITH RECURSIVE r AS (SELECT parent, child FROM tree UNION SELECT r.parent, tree.child FROM tree, r WHERE tree.parent = r.child) SELECT parent, child FROM r; transforms this: (A,B), (B,C), (B,D) into this: (A,B), (A,C), (A,D), (B,C), (B,D) |