22,209
社区成员
发帖
与我相关
我的任务
分享
update
a
set
a.a1=b.b1
from
a,b
where
a.a3=b.b3 and a.a2=2
drop table a;
drop table b;
create table a(a1 int, a2 int, a3 int);
insert into a(a1,a2,a3)
select
1,2,3 union all select
6,2,7;
create table b(b1 int, b2 int, b3 int);
insert into b(b1,b2,b3)
select
4,5,3 union all select
8,9,7;
update a
set a1=b.b1
from a, b
where a.a3=b.b3 and a.a2=2;
select * from a;
select a.a1, a.a2, a.a3,
b.b1, b.b2, b.b3
from a, b
where a.a3=b.b3;
update a
set a.a1=b.b1
from a,b
where a.a3=b.b3 and a.a2=2
UPDATE A SET A1=B1 FROM B WHERE A.A3=B.B3 AND A.A2=2