求一段SQL UPDATE 语句, 达到批量修改效果

2024-12-30 14:41:47
推荐回答(5个)
回答1:

merge into tableB b using tableA a on (a.COLUMN1=b.COLUMN2)
when matched then update set b.COLUMN2=a.COLUMN2

回答2:

update 表B
set column2=(select column2 from 表A where 表A.column1=表B.column1)

回答3:

update B
set column2=A.COLUMN2
FROM A
WHERE A.COLUMN1=B.COLUMN1

回答4:

update B set column2=A.COLUMN2
from A inner join B on A.id=B.id
where B.COLUMN2 is null

回答5:

update b set column2=a.column2
from a where a.column1=b.column1
;