SQL 递归联接
示例
递归联接通常用于获取父子数据。在SQL中,它们使用递归公用表表达式实现,例如:
WITH RECURSIVE MyDescendants AS (SELECT Name
FROM People
WHERE Name = 'John Doe'
UNION ALL
SELECT People.Name
FROM People
JOIN MyDescendants ONPeople.Name= MyDescendants.Parent
)
SELECT * FROM MyDescendants;
以上是 SQL 递归联接 的全部内容, 来源链接: utcz.com/z/315819.html