首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

oracle树形构造相关查询

2013-01-27 
oracle树形结构相关查询查询最顶层元素?select * from basic_type t WHERE NOT exists(select x from ba

oracle树形结构相关查询

查询最顶层元素

?

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'

热点排行