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
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
转载请注明:IT运维空间 » lua » Oracle对树形结构按级次排序SQL
继续浏览有关 数据库技术文章/教程 的文章
发表评论