在一张树形的数据库表中,怎样读取所有的叶子节点啊,过滤非叶子节点的节点数
解决方案 »
- 求救,SQL 语句过滤重复记录并把被过滤后的字段和
- ORACLE9.2里怎样通过日期计算筛选出符合条件的记录,请教具体SQL语句该怎么写?感激涕凌!
- oracle支持varray和nested table 数据库类型的最早版本是多少
- Oracle 存储过程问题
- 用logmnr分析日志没有得到正确的结果
- 关于数据库的一个问题,解答立即给分
- select top 1 字段1,字段2 from 表 where 条件 应该写成什么样子阿?
- 急。
- oracle服务启动错误!大家帮我看看,如何解决啊。
- 为什么我从access导出到oracle的表,在oracle中没有?
- Oracle 求助!
- oracle一个sql的问题
然后使用level伪列
能不能再具体点。
as
(select 1 as id ,0 as pid from dual
union all
select 2 as id ,1 as pid from dual
union all
select 3 as id ,2 as pid from dual
union all
select 4 as id ,3 as pid from dual
union all
select 5 as id ,1 as pid from dual
union all
select 6 as id ,5 as pid from dual)
select * from
(
select a.*,level,connect_by_isleaf flg from tt a
start with id=1
connect by prior id=pid
)
where flg =1
where level>1
start with id=:id
connect by prior childid=id