mysql将一个表字段内容赋值给另一个表字段

转载自:http://www.educity.cn/wenda/396165.html
mysql从一个表字段赋值给另一个表字段 收集
  方法一:

  mysql从一个表字段赋值给另一个表字段,在线等待。
table1 中 有字段 id,uid,name
table2 中 有字段 id,name

table1中的uid和table2中的id是一一对应的。
我如何把table2中的name一一对应赋值给table1中name
我的环境是MYSQL4.0.18nt+PHP4

------解决方案--------------------
INSERT INTO table1 (uid, name)
SELECT id AS uid,
name
FROM table2;
------解决方案--------------------
update table1,table2 set table1.name = table2.name where table1.uid = table2.id;

posted @ 2020-11-02 16:42  天道酬勤1112  阅读(1879)  评论(0)    收藏  举报