Get best records of each name using mysql

北慕城南 提交于 2020-02-07 06:56:49

问题


I'm trying to make some kind of "top" for some game stadistics

Table it's like this

mapname     authid  country     name    time    date    weapon  server

I've got this query, but it's not ok

SELECT *, min(time) FROM kz_nub15 WHERE mapname = '".$map."' GROUP BY name ASC ORDER BY time ASC LIMIT 15

I'm trying to get the best 15 times for a mapname, but only showing the best time of each name


回答1:


How about trying it this way:

SELECT *
FROM kz_nub15
WHERE mapname = '".$map."'
GROUP BY name
ORDER BY time ASC
LIMIT 15



回答2:


This is because of min() , take out min() and try again.



来源:https://stackoverflow.com/questions/10012054/get-best-records-of-each-name-using-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!