表A 字段 A_ID, A_NAME, B_ID
表B 字段 B_ID, B_NAME
需求把A的所有A_NAME更新为相应的B的 B_NAME。
mysql做法:
UPDATE ALEFT JOIN
B
ON
A.B_ID = B.B_ID
SET
A.A_NAME = B.B_NAME;
MSSQL做法:
update Aset A_NAME = B.B_NAME
from A left join B
ON
A.B_ID = B.B_ID
UPDATE ALEFT JOIN
B
ON
A.B_ID = B.B_ID
SET
A.A_NAME = B.B_NAME;
update Aset A_NAME = B.B_NAME
from A left join B
ON
A.B_ID = B.B_ID