设为首页 加入收藏

TOP

oracle树形结构相关查询
2014-11-24 02:25:02 来源: 作者: 【 】 浏览:0
Tags:oracle 树形 结构 相关 查询

oracle树形结构相关查询
查询最顶层元素
www.2cto.com
select * from basic_type t WHERE NOT exists(select 'x' from basic_type t1,
basic_type t2 where t1.id=t2.parentid and t1.id= t.parentid)
查询id为'asdfas'的属于顶层ID为4的第几级
select * from (select LEVEL,id,parentid,name from basic_type START WITH id='4'
CONNECT BY PRIOR id=parentid) where id= 'asdfas'
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇MySQL模拟Oracle邻接模型树形处理 下一篇oracle树形sql查询实例分析

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: