Oracle对树形结构按级次排序SQL

1、自顶向下查找
      select t.name, t.id
  from tree t
 start with t.id = 'top'
CONNECT BY PRIOR t.id = t.parent_id
 order SIBLINGS by t.order_no
2、自底向上查找
select t.name, t.id
  from tree t
 start with t.id = 'top'
CONNECT BY PRIOR t.parent_id = t.id
 order SIBLINGS by t.order_no

posted on 2009-10-12 13:47  Hero King  阅读(1465)  评论(0编辑  收藏  举报

导航