读书人

求oracle 多表update方法解决方法

发布时间: 2012-01-13 22:43:30 作者: rapoo

求oracle 多表update方法
t1
-----------------------
id A B C

t2
---------------------
id F

如果满足条件:t1.id = t2.id , t1.B = '0 ', F = null
就把F的值设置为C
请问如何实现 ?



[解决办法]
update t2 set t2.XX= 'F ' from t1,f2 where t1.id = t2.id and t1.B = '0 ' and F = null

[解决办法]
我来帮顶来了!!!!!
[解决办法]
update t2 set t2.F= 'C ' from t1,f2 where t1.id = t2.id and t1.B = '0 ' and F IS null 才行; Null是不能用‘=’的
[解决办法]
update t2 set t2.F=(select t1.C from t1 where t1.id = t2.id and t1.B = '0 ' and t2.F IS null )
[解决办法]
试试上面的sql应该可以的
[解决办法]
没反应?

[解决办法]
~~路过~帮顶~~
[解决办法]
ding
[解决办法]
~~路过~帮顶~~

[解决办法]
update t2 b
set b.f =
(select a.c from t1 a
where a.id = b.id and b.b <> 0 and a.f is null
)

读书人网 >Java Web开发

热点推荐