with cte_child(id,areaName,pid)
as
(
–起始条件
select id,areaName,pid from erp_area
where id = 44 –列出子节点查询条件
union all
–递归条件
select a.id,a.areaName,a.pid
from erp_area a
inner join
cte_child b –执行递归
on a.id=b.pid
)
select * from cte_child;
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/275495.html