How do I select top ranker by date in MySQL
I do have a user data base with rank.what I am looking is how do I select top rank person based on today's search开发者_如何学C?? and I need to do this in daily basis.
This will do:
SELECT id, rank, something
FROM person
WHERE date = DATE(NOW())
ORDER BY rank DESC LIMIT 1;
Try:
SELECT MAX(rank), id
FROM mytbl
WHERE date = mydate
GROUP BY id
精彩评论