最赞回答 / 哈你
我们紧接上楼,内部优化完毕的sql是这样的SELECT d.user_name, c.timestr, kills FROM (SELECT a.user_id, a.timestr, a.kills, COUNT(b.kills) cnt FROM kills AS a JOIN kills b ON a.user_id = b.user_idWHERE a.kills <= b.killsGROUP BY a.user_id, a.timestr, a.kills) AS c JOIN work...
2016-10-16
我用自己写的也可以查出来
select a.name,b.kill_date,MAX(b.kill_num) max_kill
from `user` a join `kill` b ON a.id=b.user_id
GROUP BY a.name;
select a.name,b.kill_date,MAX(b.kill_num) max_kill
from `user` a join `kill` b ON a.id=b.user_id
GROUP BY a.name;
2016-09-29