oracle的connect⽤法,oracleconnectby⽤法就不转载原⽂了,来个更加简单易懂的说法.
有数据表 a:
no upno
010102 0101
010101 0101
0101 01
01
select * from a start with no='010101' connect by no=prior upno;
查询结果为:
connect下载010101
0101
01
将upno和no换个位置:
select * from a start with no='0101' connect by upno=prior no;
查询结果为:
0101
010101
010102
注:
select * from emp connect by upno=prior no start with no='0101';
//与select * from a start with no='0101' connect by upno=prior no;效果⼀致
与select * from emp connect by prior upno=no start with no='0101';效果相反
重点在于prior的位置
select * from a start with no='010101' connect by no=prior upno;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论