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.

猜你喜欢

转载自ysa198584.iteye.com/blog/1886587