高分求:SQL解决办法 select t.*,level from table tstart with b='0000'connect by prior b=a 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这样写更清晰一点吧.select t.b,level from table tstart with b='0000'connect by prior b=aorder by level,b select 本级部门from 表connect by prior 本级部门=上级部门start with 上级部门='0000'; SQL> select * from t;ID PID---- ----0000 0001 00000002 00000003 00000011 00010012 00010021 00020022 00020031 00030032 00030033 000311 rows selectedSQL> select id from t start with id = '0000' connect by pid = prior id;ID----0000000100110012000200210022000300310032003311 rows selectedSQL> select id,level from t start with id = '0000' connect by pid = prior id;ID LEVEL---- ----------0000 10001 20011 30012 30002 20021 30022 30003 20031 30032 30033 311 rows selected 下面的linux版本号一至吗? 如果获取某个用户下所有的表中的记录数? 怎么把两条sql语句查询的结果放在一起(子节点父节点分开查询) 在用户A和用户B工作中发生死锁时系统会ROLLBACK哪一个呢? oracle数据库数据导入的问题(急) WIN2K下如何只允许指定的IP地址连接ORACLE服务器? 求一条sql语句:不重复的选择记录 还是刚才的问题,jiezhi(浪子) 请进 请问诸如删除表一类的事件在哪里可以查看的到? 安装oracle9i和安装oracle8i相比,有那些不同点 有没有实现把空字符自动变为0的oracle函数???急~~~~~~~~ 求一SQL语句
select t.b,level from table t
start with b='0000'
connect by prior b=a
order by level,b
from 表
connect by prior 本级部门=上级部门
start with 上级部门='0000';
---- ----
0000
0001 0000
0002 0000
0003 0000
0011 0001
0012 0001
0021 0002
0022 0002
0031 0003
0032 0003
0033 000311 rows selectedSQL> select id from t start with id = '0000' connect by pid = prior id;ID
----
0000
0001
0011
0012
0002
0021
0022
0003
0031
0032
003311 rows selectedSQL> select id,level from t start with id = '0000' connect by pid = prior id;ID LEVEL
---- ----------
0000 1
0001 2
0011 3
0012 3
0002 2
0021 3
0022 3
0003 2
0031 3
0032 3
0033 311 rows selected