原载于:转www.载for网站制作学习asp必.cn究
 在常见的mysql操作中有这样的一种需求,根据一个表内容更新另一个表的内容,比如
用户表forasp_user
id  username pwd
1   jack xxxx
2   rose    xxxx
..
 
成绩表cn_score
uid  score
1    99
2    98
..
需求 在score中新增 username 将uid 和用户表user id对应并更新到score中
得到 成绩表cn_score
uid  score username
1    99    jack
2    98   rose
..
 
mysql多表更新很简单,实现上述功能
update forasp_user,cn_score set cn_score.username = forasp_user.username where forasp_user.id = cn_score.uid
这样便实现了多表更新

原载于:网f站o学a习s制p作.cn