解决方案 »
- 请教ORDER BY的查询优化:如何解决"Using temporary; Using filesort"
- 如何优化这个sql语句
- mysql事务
- 遇到这样一个效率问题,不知道如何解决。
- 请教数据导入的问题
- 请求一SQL语句!急
- I have download the sourcecode of the Mysql . but I can not find the development document(I have try my best to do it )
- 关于mysql的权限,答对均有份,急+在线等待,谢谢
- 菜鸟问题,求一条查询语句
- mysql分组,请高手指教
- 关力两次left join后的笛卡尔乘积的问题
- mysql 查询名次
表一 a
id user rank exp addtime expchange
1 a 1 11 今天 1 a 1 9 昨天
结果 id user rank exp addtime expchange
1 a 1 11 今天 2sql怎么写?
update a set expchange=(select exp from a where addtime=昨天) where id=1
这样吗?
如果一次更新二三百条,数据记录多了,效率哪个更高?
报错
#1093 - You can't specify target table 'a' for update in FROM clause
我才想那么做的,update 和select 的 表是一个会报错 或者是我写的不对
UPDATE `a` SET `expchange`=(select `exp` from `a` as b where a.user = b.user and addtime=昨天 )-exp WHERE a.addtime=今天