34,590
社区成员
发帖
与我相关
我的任务
分享
update t2 set c=t1.b from t1 inner join t2 on t1.a=t2.a
updaet t2 set c=t1.b from t1,t2 where t1.a=t2.a
update t2
set c=tt1.b
from t2 tt2 inner join t1 tt1
where tt1.a=tt2.a
UPDATE t2
SET t2.c=t1.b
FROM t1,t2
WHERE t1.a=t2.a
declare @t1 table([a] int,[b] int)
insert @t1
select 1,2 union all
select 2,5
declare @t2 table([a] int,[c] sql_variant)
insert @t2
select 1,null union all
select 2,null
update @t2
set c=t1.b
from @t1 t1, @t2 t2
where t2.a=t1.a
select * from @t2
/*
a c
1 2
2 5
*/