MySQL:根据来自其他 table 的值更新列值

MySQL: Update column values by values from from other table

有 2 个 MySQL 表:

table1
id   name   phone

table2
id   phone

记录数 > 200 亿。

如何通过 table2.phone 中 table1.id = table2.id 的值更新 table1.phone?

我的版本是:

mysql  Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1

您似乎需要 update ... join 语法:

update table1 t1
inner join table2 t2 on t1.id = t.id
set t1.phone = t2.phone