首页 > 数据库技术 > 详细

mysql 将一张表的数据更新到另外一张表中

时间:2019-03-18 11:44:37      阅读:380      评论:0      收藏:0      [点我收藏+]

update 更新表 set 字段 = (select 参考数据 from 参考表 where  参考表.id = 更新表.id);

update table_2 m  set m.column = (select column from table_1 mp where mp.id= m.id);

例如: update person p set p.login_account_id=(select ID from user u where p.person_code=u.LOGIN_NAME and p.person_code=‘4500‘);

方法二:

  update table_1 t1,table_2 t2 set t1.column = t2.column where t1.id = t2.pid;

mysql 将一张表的数据更新到另外一张表中

原文:https://www.cnblogs.com/Samuel-Leung/p/10551101.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!