小编lou*_*rdh的帖子

获取父母的所有后代

我有一个包含两列的表,Parent并且Child.

我需要获取与父记录关联的所有后代的列表。

Source Table
+----+-----------+
| Parent | Child |
+----+-----------+
|  a     |     b |
|  b     |     c |
|  c     |     d |
|  d     |     e |
|  e     |     f |
|  f     |     x |
+----+-----------+

Expected Result:
+----+-----------+
| Parent | Child |
+----+-----------+
|  a     |     b |  // As b is the child of a, all the descendants of b 
|  a     |     c |  // are …
Run Code Online (Sandbox Code Playgroud)

recursive

10
推荐指数
1
解决办法
5万
查看次数

标签 统计

recursive ×1