select st_id,st_day,st_sc_id,st_s_id,st_p_id,st_nums tdn,st_money tdm
from sum_total where st_id in (select max(st_id) from sum_total where
st_day<=1286121600 and st_sc_id=8 and st_s_id=31
group by st_s_id,st_p_id)
这句SQL应该怎么样优化下才可以执行的快一点么?求大侠指点
from sum_total where st_id in (select max(st_id) from sum_total where
st_day<=1286121600 and st_sc_id=8 and st_s_id=31
group by st_s_id,st_p_id)
这句SQL应该怎么样优化下才可以执行的快一点么?求大侠指点
解决方案 »
- mysql中timestamp字段不随该列更新某字段而更改时间~~~要怎么做
- 删除两个表中没有匹配的记录
- (菜鸟飞飞)怎么在数据库中涉及散列
- mysql的主从问题 从服务器对数据库修改不会影响主的数据库么?
- 问下,如何在mysql中查询当天的数据
- mysql数据库utf8简体中文如何转繁体
- 急,修改完mysql登陆密码后,无法进入phpmyadmin.
- 在Mysql中居然字符 林=丽,为什么呢?请问哪位大侠也遇过?
- mysqldump导入错误 ERROR 2002 (HY000): Can't connect to local MySQL server
- MySQL批量插入的问题
- navicat lite for mysql中文记录显示乱码
- mysql-noinstall精简方略
数据库为MYSQL
好像是st_id in 的原因执行很缓慢,所以想求教下这样的句子应该怎么优化下~
from sum_total a inner join
(select max(st_id) as ma from sum_total where
st_day<=1286121600 and st_sc_id=8 and st_s_id=31
group by st_s_id,st_p_id) b on a.st_id=b.ma