您的位置:首页 > 数据库 > Oracle

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: