日期:2014-05-17  浏览次数:20880 次

循环查询一问
表如下
preant         child
1 101
1 102
1 103
101 10101
101 10102
102 10201
103 10301
10101 1010101

查询preant为1的所有child
1         101
1         102
1         103
1         10101
1         10102
1         10201
1         1010101
1         10301
1         1


怎么用connet   by实现?

------解决方案--------------------
select * from table
start with preant= '1 '
connect by prior child=preant
------解决方案--------------------
才注意你的表结构,没有child的值,那你怎么确定preant为1的所有child的?
表如下
preant child
1101
1102
1103
10110101
10110102
10210201
10310301
101011010101

------解决方案--------------------
加入ORACLE的群吧;群号是:19312711