求sql语句 A表有 列1,列2 B表有 列1,列2 现在想 如果 A表列1=B表列1,用B表列2的值替换A表列2的值

a,b两个表在同一个数据库里
2025-03-01 04:52:49
推荐回答(2个)
回答1:

uddate tableA set 列2=tableB.列2 from tableA tableB where tableA .列1=tableB .列1

回答2:

update t1
set 列2=t2.列2
from 表A T1,
表B t2
where t1.列1=t2.列1