1.2 递归做法
1.2.1 递归做法
select t.orgid, t.parentid, t.orgname from um_organization t connect by t.orgid = PRIOR t.parentid start with t.orgid = 82 |
1.2.2 递归做法 _ 层次
select t.orgid, t.parentid, t.orgname,LEVEL 层次 from um_organization t connect by t.orgid = PRIOR t.parentid start with t.orgid = 82 |
1.2.3 查找子节点
select t.orgid,t.parentid,t.orgname from um_organization t connect by t.parentid= PRIOR t.orgid start with t.orgid= 80 |
1.2.4 查找子节点 _ 层次
select t.orgid,t.parentid,t.orgname,LEVEL 层次 from um_organization t connect by t.parentid= PRIOR t.orgid start with t.orgid= 80 |
1.2.5 生成树
select * from (select t.orgid, t.parentid, t.orgname, LEVEL 层次
from um_organization t
connect by t.parentid = PRIOR t.orgid
start with t.orgid = 1
) where 层次 = 2