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;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM