递归查询全部子节点html
建人员表 hrmresourcesql
主键 姓名 上级IDoracle
层级关系:
- 4
- 3
- 2
- 1
- 5sqlserver
SELECT * FROM Myhrmresource
START WITH id=3
CONNECT BY PRIOR id=manageridpost
结果:url
with result_table as
(
select a.id,a.name,a.managerid from myhrmresource a where id=3
union all
select k.id,k.name,k.managerid from Myhrmresource k inner join result_table c on c.id = k.managerid
)select * from result_tableserver
结果:htm