WITH AS(子查询部分,递归查询)
1. 查询指定树形结构的所有子节点(递归)
with subqry(id,name,pid) as (
select id,name,pid from test1 where id = 5 --指定id
union all
select test1.id,test1.name,test1.pid from test1,subqry where test1.pid = subqry.id...
原创
2020-03-13 15:43:10 ·
655 阅读 ·
0 评论