搜索墙首页  编程技术  java  asp  ajax  php  c/c#/c++  数据库  oracle  mysql  db2  操作系统  windows  linux  股吧
首页 > 编程 > 数据库 > oracle
 1         
1楼  wyplay 2007-06-06 10:20:59

表如下
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实现?
2楼  HelloWorld_001 2007-06-06 10:25:35

select   *   from   table
start   with   preant= '1 '
connect   by   prior   child=preant
3楼  wyplay 2007-06-06 10:34:46

这样查询只能出来
            parent             child
1 101
1 102
1 103
4楼  HelloWorld_001 2007-06-06 14:17:34

才注意你的表结构,没有child的值,那你怎么确定preant为1的所有child的?
表如下
preant         child
1101
1102
1103
10110101
10110102
10210201
10310301
101011010101
5楼  wyplay 2007-06-06 14:35:49

拿preant1为例
1的child有101,102,103
101的child有10101,10102
10101的child有1010101

关系就出来了
1的下级包括
101,102,103,10101,10102,1010101
6楼  murfy_mf 2007-06-06 14:50:46

加入ORACLE的群吧;群号是:19312711
 1         
您的发言将按有关规定都会存档,您须为所发表后果负责,请您遵纪守法并注意语言文明。
标题:循环查询一问
热门关注
标题回复点击
Oracle 10g (ASM):Sample Implementation0743
Oracle 正版用户授权0692
动态性能视图(Dynamic perfermance view V$)0686
EM 无法启动&&重新完全配置EM0560
小布老师Oracle 9i DBA Fundamentals II0345
ORA-1652: unable to extend temp segment诊断以及解决0308
缓冲处理器 buffer handle0275
locate pl/sql bottleneck0271
OracleDBConsole 服务因 2 (0x2) 服务性错误而停止。请问一下如何解决!2267
L1:Buffer Cache0264
搜索墙@2009 www.pkwall.com all rights reserved QQ:276471788 [京ICP备09111534号]
声明:本站部分数据来源于网络,仅供参考,如有版权问题,请联系我们,我们将及时删除!转载本站请注明来源