# 树形查询
自下向上
select p1.f_itemid, p1.f_parentid, p1.f_itemcode, p1.f_itemname
from lr_base_dataitem p1
start with p1.f_itemcode = '' {0} ''
connect by prior p1.f_parentid = p1.f_itemid
1
2
3
4
2
3
4
自上向下
select *
from sys_office p1
start with p1.code =100014
connect by prior p1.id=p1.parent_id
1
2
3
4
2
3
4