一般用到递归查询,一般是树形接口,或者其他类似树接口的场景;一般就是组织机构或者菜单
-- 这个是通过父节点找所有的子节点
select *
from xxx_MENU t
start with t.cguid = '64cbd328ef86eb7f1d'
connect by prior t.cguid = t.cparentid;
-- 这个是通过子节点找父节点
select *
from xxx_MENU t
start with t.cguid = '8e76aac2ea0d2e1302'
connect by t.cguid = prior t.cparentid;
-- 他们的区别是prior 关键字的位置,自己key测试下;还有start with 类似where了, 后面跟条件即可,知否可以写聚合,没试过