SELECT p.id,p.playname,p.wanfa,t.id AS tzid,t.zhid,t.idchar,t.czlx,t.wanfa,t.qihao,t.money,t.zjmoney,t.jjz,t.beishu,t.ms,t.`addtime`,t.zt AS tzzt,qh.qihao,qh.kjhm,qh.czlx,u.uid,u.username,t.uid
FROM tz AS t
Inner Join playgroup AS p ON t.wanfa = p.wanfa
Inner Join qihaoinfo as qh ON t.qihao = qh.qihao AND t.czlx = qh.czlx
Inner Join username as u ON t.uid = u.uid and u.uid = '32' and
(t.addtime >='1322064000' and t.addtime <= '1322150399')
GROUP BY t.id
order by t.id desc
limit 0,20
------解决方案-------------------- 1、你的SQL语句不是标准的; 2、将你的查询存为VIEW,假设ID唯一 select * from view1 a where not exists(select 1 from view1 where a.zhid=zhid and a.id>id)
------解决方案-------------------- 先贴出你的 explain select ... show index from ...