mysql语句收录

原创或者转载别人的,收集日常使用到的,不熟悉的sql语句
1、Mysql 根据一个表数据更新另外一个表
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 table_1 t1,table_2 t2 set t1.column = t2.column where t1.id = t2.pid;

猜你喜欢

转载自blog.csdn.net/zhaoxichen_10/article/details/84987621
今日推荐