本文主要讲述在mysql数据库中,如何使用update join实现多表数据更新。
update join语法
update join SQL语法如下所示:
UPDATE T1, T2
SET T1.c2 = T2.c2,
T1.c3 = T2.c3
WHERE T1.id = T2.id AND condition
或:
UPDATE T1
INNER JOIN T2 ON T1.id = T2.id
SET T1.c2 = T2.c2
T1.c3 = T2.c3
WHERE condition