oracle connect by 用法(2)
2011-06-03 16:58
316 查看
SELECT level,tc_appma001,tc_appma002,tc_appma003
FROM whh.tc_appma_file
start with tc_appma003=0
connect by tc_appma003 = prior tc_appma001
order by level
原表:
001 002 003
1 生產排程 0
2 機台排程 1
3 原料排程 1
4 訂單加急 2
5 原料加急 4
6 模具加急 4
之後:
level 001 002 003
1 1 生產排程 0
2 2 機台排程 1
2 3 原料排程 1
3 4 訂單加急 2
4 6 模具加急 4
4 5 原料加急 4
FROM whh.tc_appma_file
start with tc_appma003=0
connect by tc_appma003 = prior tc_appma001
order by level
原表:
001 002 003
1 生產排程 0
2 機台排程 1
3 原料排程 1
4 訂單加急 2
5 原料加急 4
6 模具加急 4
之後:
level 001 002 003
1 1 生產排程 0
2 2 機台排程 1
2 3 原料排程 1
3 4 訂單加急 2
4 6 模具加急 4
4 5 原料加急 4
相关文章推荐
- oracle connect by用法篇
- Oracle Connect By Prior用法(实现递归查询)
- Oracle_start_with_connect_by_prior_用法
- oracle connect by用法篇
- Oracle start with..Connect By prior..用法实例讲解
- Oracle CONNECT BY的用法
- Oracle START WITH...CONNECT BY PRIOR的用法
- oracle start with connect by 用法
- 转:Oracle的Start with ...Connect by 用法
- ORACLE-START WITH....CONNECT BY用法
- SYS_CONNECT_BY_PATH函数用法 ORACLE
- oracle start with connect by 用法
- Oracle Connect By用法 树形结构查询
- oracle start with connect by 用法
- Oracle Connect By用法
- oracle connect by用法补充
- oracle start with connect by 用法
- Oracle Connect By Prior用法(实现递归查询)
- 【ORACLE】connect+by的简单用法
- Oracle中sys_connect_by_path函数用法