17,078
社区成员
发帖
与我相关
我的任务
分享
MERGE INTO A
USING B
ON (A.a = B.d)
WHEN MATCHED THEN
UPDATE
SET A.b=B.f,A.c=B.g;
-- 一次性更新多列数据,别用 cursor ,太慢了
update A
set (b,c) = (select f,g from B where A.a = B.d)
where exists(select * from where A.a = B.d)
-- 括号中的子查询,只写一个表名,不要把两个表名都写进去。
set (b,c) = (select f,g from B where A.a = B.d)
-- 你给改下面的格式了(这个写法不对)
set (b,c) = (select f,g from A,B where A.a = B.d)
update employeeinfo
set (mobile,phone)=(select dh,dh2 from usertemp where employeeinfo.employeename=usertemp.xm),
where
exists(select * from employeeinfo e ,usertemp where e.employeename=usertemp.xm);
但是
merge into usertemp
using employeeinfo
on (usertemp.xm=employeeinfo.employeename)
when matched then
update
set usertemp.dh= employeeinfo.mobile, usertemp.dh2=employeeinfo.phone;
测试通过,不知道为什么
-- 一次性更新多列数据,别用 cursor ,太慢了
update A
set (b,c) = (select f,g from B where A.a = B.d)
where exists(select * from where A.a = B.d)