Sql Server联表等更新
这次分享下sql的联表更新方法。顺带着也有更新top的方法,只要加括号就行。很简单的东西分享下,给新手学习
第一种,
UPDATE top(10) so
SET a.Column1= b.Column2
FROM a WITH(NOLOCK),
b WITH(NOLOCK)
WHERE a.Id = 11
第二种(带有联表方式)
update top(10) t1 set col1=t2.col1
from table1 t1
inner join table2 t2 on t1.col2=t2.col2
from table1 t1
inner join table2 t2 on t1.col2=t2.col2

浙公网安备 33010602011771号