Recursive JOINs
suggest changeRecursive joins are often used to obtain parent-child data. In SQL, they are implemented with recursive common table expressions, for example:
WITH RECURSIVE MyDescendants AS (
SELECT Name
FROM People
WHERE Name = 'John Doe'
UNION ALL
SELECT People.Name
FROM People
JOIN MyDescendants ON People.Name = MyDescendants.Parent
)
SELECT * FROM MyDescendants;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents