要将 table_src里面某列的多行update 到table_dst里面的多行里面去,在db2 里面使用merge很方便
merge into table_dst a
using table_src b
on (a.form_code=b.form_code) and (a.control_id=b.control_id) and (a.locale_id=b.locale_id) and a.control_name='发送者'
when matched then
update set
a.control_name=b.control_name
用下面的sql则有报错,不行
update table_dst a set a.control_name=(select b.control_name from table_src b where a.form_code=b.form_code and a.control_id=b.control_id and a.locale_id=b.locale_id and a.control_name='发送者')
阅读(1042) | 评论(0) | 转发(0) |