tab1
id name telphone address
1 a1 a2 a3
2 b1 b2 b3
在MYSQL里想用id=2的name(b1) 去更新替换id=1的name(a1)
以前的流程分两步
先查出值id=2的$name = tab2.name
然后更新updata tab1 set name=$name where id = 1
上面这个两步能否合并成一步(一条SQL)完成呢?
1
xiao303178394 2015-04-20 17:31:13 +08:00 1
|
2
Septembers 2015-04-20 17:34:06 +08:00 1
SELECT ... UPDATE ...
see https://dev.mysql.com/doc/refman/5.7/en/innodb-locking-reads.html |
3
jookr OP @xiao303178394 灰常感谢
|
4
jookr OP @Septembers 谢谢
|