I have the ff table:
---------------------------
ID | ChapterNo | HitCount |
---------------------------
1 | 2 | 1000 |
2 | 2 | 2000 |
3 | 1 | 3000 |
4 | 3 | 1000 |
5 | 1 | 3500 |
---------------------------
Basically I need to archive this result:
Get all the unique chapterno where each have the highest hit count and then order by chapterno descending
ID | ChapterNo | HitCount |
---------------------------
4 | 3 | 1000 |
2 | 2 | 2000 |
5 | 1 | 3500 |
---------------------------
I tried the ff. query:
SELECT t1.*, Max(t1.hitcount) AS maxhit
FROM chapter as t1
GROUP BY t1.chapterno
ORDER BY t1.chapterno DESC
But some how it doesnt return the one with highest hitcount.
How can I fix this?
Thank you