您的位置:首页 > 数据库 > MySQL

Mysql中用一个表更新另一个表

2017-07-21 17:08 190 查看
1.修改一列:

update A a,B b

set a.name=b.name

where a.id=b.id;

2.修改多列:

update A a,B b

set a.name=b.name,a.code=b.code

where a.id=b.id;

3.采用子查询

update A a set a.name=(select name from B b where a.id=b.id);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql update