A、B两张表,通过关联字段A1=B1,复制B表字段B2中数据到A表A2中
update A a set a.A2 = (select b.B2 from B b where b.B1=a.A1) where exists (select 1 from B where B.B1=a.A1)
写成如下
update A a set a.A2 = (select b.B2 from B b, A c where b.B1=c.A1) where exists (select 1 from B where B.B1=a.A1)则是从两个表交叉集合取值,错误结果
参考自http://www.2cto.com/database/201304/202364.html