mysql update select用法实例
2017-01-29 00:20
288 查看
http://www.3lian.com/edu/2014/05-13/147149.html
在mysql中,不能直接使用set select的结果,必须使用inner join:
update a inner join (select yy from b) c on a.id =b.id set a.xx = c.yy
如下一条经典Mysql update语句赋值嵌套select实例
update mem_player set `DataWarehouse`=(select `DataWarehouse` from (select * from mem_player) as b where `Pid`=100000)
==============================================
update course inner join (select courseId from course_lesson where id = 3517) c on course.id =c.courseId set course.hitNum=course.hitNum + 1
在mysql中,不能直接使用set select的结果,必须使用inner join:
update a inner join (select yy from b) c on a.id =b.id set a.xx = c.yy
如下一条经典Mysql update语句赋值嵌套select实例
update mem_player set `DataWarehouse`=(select `DataWarehouse` from (select * from mem_player) as b where `Pid`=100000)
==============================================
update course inner join (select courseId from course_lesson where id = 3517) c on course.id =c.courseId set course.hitNum=course.hitNum + 1
相关文章推荐
- mysql update select 用法
- MySQL中insert ignore into, on duplicate key update,replace into,insert … select … where not exist的一些用法总结
- MySQL update join 用法实例
- Mysql InnoDB中的查询事务模式与锁定select ..for update
- mysql的insert into from select 和update by select
- OLEDB Excel INSERT UPDATE SELECT用法
- [MySQL] SELECT ... FOR UPDATE 的 Row Lock 與 Table Lock
- mysql 去除重复 Select中DISTINCT关键字的用法
- SQL语句详解 MySQL update的正确用法
- Mysql的Replace和ON DUPLICATE KEY UPDATE的用法与作用
- ODBC连MySQL实例用法
- 关于MySQL的init-file选项的用法实例
- mysql 数据操纵:SELECT, INSERT, UPDATE, DELETE
- vb.net 2008 dataTable Sort()函数和Select()函数用法实例
- SQL语句详解 MySQL update的正确用法
- SQL cte select 与 update 实例
- MySQL 4.1.0 中文参考手册 --- 6.4 数据操纵:SELECT, INSERT, UPDATE, DELETE
- MySQL中的行级锁SELECT FOR UPDATE 和LOCK IN SHARE MODE 区别
- mysql 去除重复 Select中DISTINCT关键字的用法
- mysql update 语句用法