mysql 一张表update另一张表
2015-06-06 23:03
531 查看
有三种方法:
Solution 1: 1列
Solution 2: 多个列
Solution 3: 子查询
Solution 1: 1列
update student s, city c set s.city_name = c.name where s.city_code = c.code;
Solution 2: 多个列
update a, b set a.title=b.title, a.name=b.name where a.id=b.id
Solution 3: 子查询
update student s set city_name = (select name from city where code = s.city_code);
相关文章推荐
- mysql旧表去重数据导入新表且赋予主键id新值
- ajax+jsp+servlet+mysql实现登陆验证
- MySQL Replication的Reset slave重置命令
- mysql在windows下两种安装方法
- MySQL索引原理及慢查询优化
- Mysql中的排序规则utf8_unicode_ci、utf8_general_ci的区别总结
- 第17章 Mysql复制
- mysql
- mysql无法添加外键约束(cannot add foreign key constraint)
- mysql int(10)的含义
- MySQL的alter table
- mysql-查看全局变量设置
- 关于 Mysql 的下载
- MySql 中文乱码排查解决方案
- MySQL取得当前时间的函数是什么 格式化日期的函数是什么
- mysql三学习sql声明学习
- 介绍一下mysql的日期和时间函数
- 修改mysql配置的影响
- mysql,sqlite 联表查询 join
- mysql导入导出