欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

oracle 同一表中父类关联子类

程序员文章站 2022-07-10 15:10:39
...
select * from IAPS_BRANCH where
PARENT_BRANCH_ID='$branchId$'
order by BRANCH_ID


-- 通过父类查找对应的所有子类 
select branch_id from iaps_branch where
branch_id!='$parentBranchId$' start with branch_id =
'$parentBranchId$' connect by prior branch_id = parent_branch_id