Oracle语句如下:
使用方法:start with.....connect by prior。其中start with后面跟的条件1是父节点的查询条件,connect by prior后面跟的条件2是与记录的父节点相同的子节点中的数据。
示例:
SELECT id,
name as text,
parent_id as parentId
from TF_SYS_T_ACTION action
where 1 = 1
and action.id in (select caction.action_id
from TF_SYS_T_CUSTOMERACTION caction
where caction.cust_domain = '110108')
START WITH parent_id = '0'
CONNECT BY PRIOR id = parent_id
其功能是查询父节点与其下的子节点中的数据。