ganlan

oracle父子级查询数据树结构

1、select t.*, level , sys_connect_by_path (t .id, '-->') as tree from isc_res_res_r t connect by prior t.res_id =t .relation_res_id;

 

2、 表结构数据如下

 

 

树结构查询sql

select level , sys_connect_by_path (t .res_name, '-->') as tree, t.* from S_P_RESOURCE t
start with t.id = 'bd65b0fa947844fb86c633d9e1c051b9'
connect by prior T.ID = t.parent_id order by level ,tree

 

 

posted on 2019-12-03 13:33  甘岚  阅读(1145)  评论(0编辑  收藏  举报

导航