Db2 多表关联更新
有两个表 test1 test2
test1 的字段 a, b
test2 的字段 a, c
实现类似这样的功能 : update test1,test2 set test1.b = 'b' where test1.a = test2.a and test2.c = '22'
问题点数:20、回复次数:1Top
1 楼bluescorpian()回复于 2006-10-28 16:13:46 得分 0
update test1
set b = ( select 'b'
from test 2
where test1.a = test2.a and
test2.c = '22'
)
或者
update test1
set b = 'b'
where a in ( select a from test2 where c = '22')
区别自己看Top





