[英]MySQL: Update column values by values from from other table
There is 2 MySQL tables as:有 2 个 MySQL 表:
table1
id name phone
table2
id phone
The record count > 20 billions.记录数 > 200 亿。
How to update table1.phone by values from table2.phone where table1.id = table2.id?如何通过 table2.phone 中的值更新 table1.phone,其中 table1.id = table2.id?
My version is :我的版本是:
mysql Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1
You seem to want the update ... join
syntax:您似乎想要
update ... join
语法:
update table1 t1
inner join table2 t2 on t1.id = t.id
set t1.phone = t2.phone
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.