Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1896131
  • 博文数量: 389
  • 博客积分: 7877
  • 博客等级: 少将
  • 技术积分: 4521
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-10 14:02
文章分类

全部博文(389)

文章存档

2024年(1)

2022年(1)

2021年(1)

2020年(1)

2019年(1)

2018年(3)

2017年(6)

2016年(4)

2015年(8)

2014年(15)

2013年(31)

2012年(19)

2011年(47)

2010年(33)

2009年(105)

2008年(109)

2007年(4)

分类:

2010-03-19 14:22:27

要将 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='发送者')
阅读(990) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~