问题
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