oracle树查询语句
oracle树查询语句
oracle select * from tab_organization start with strupcode is null connect by prior strcode=strupcode order siblings by strcode asc .....start with .A... connect by prior ...B ..order siblings .C
注意:tab_organization 中的strupcode是父节点的编码,这是一个关联。
A:表示顶级节点的条件,这里是 strupcode is null
B:上下两级节点关联的条件,strcode=strupcode,当前节点的strcode等于下级节点的strupcode.