oracle递归查询的问题,如何查询出现机构和其属下所有机构

2025-05-21 00:15:27
推荐回答(3个)
回答1:

select *
from table_name
where 1 = 1 --没有条件可以不写where
connect by parent_id = prior child_id
start with parent_id = 1

回答2:

select orgid,fatherorgid,orgname
from gias_org
start with fatherorgid= 1
connect by prior orgid= fatherorgid
--如果需要排序
order siblings by 要排序的字段

回答3:

select * from gias_org where fatherorgid =1 and orgid=1;