作者cde123 (cde123)
看板Database
标题[SQL ] Oracle update 问题...
时间Tue Nov 20 17:10:43 2007
现在有这样的资料
ID col_A
-----------------
1 A
2
3
4
5 B
6
7
8
9
10
我希望可以 2,3,4 都填成 A ,6,7,8,9,10 都填成 B 就是往前找值
我是用
update table tb_A set tb_A.col_A = (select tb_B from table tb_B where
tb_B.ID = tb_A.ID-1) where tb_A.col_A is null
可是只做成了...
ID col_A
-----------------
1 A
2 A
3
4
5 B
6 B
7
8
9
10
我用的是 Oracle ,这需要怎样修改呢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.57.244.98