How can I select the 100 largest rows in a table based on a column 'score'?
I can find the largest score in the 'score' colum开发者_高级运维n with:
SELECT max(score) FROM mTable
And then obtain that row(s):
SELECT * FROM mTable WHERE score=largestScore
But how would I wrap this up and obtain the following 99 lower scored rows?
Thanks.
Use:
SELECT t.*
FROM MTABLE t
ORDER BY t.score DESC
LIMIT 100
Formatted:
Select *
from mtable
order by score desc
limit 100
SELECT columnList
FROM mTable
ORDER BY score DESC
LIMIT 100
精彩评论