MySQL limit range

后端 未结 5 1411
无人及你
无人及你 2020-12-05 18:32
SELECT name FROM mydb ORDER BY score DESC LIMIT 10;

The query above will return the first 10 ranks.

How to modify the LIMIT, o

5条回答
  •  一向
    一向 (楼主)
    2020-12-05 18:58

    You should use:

    SELECT name FROM mydb ORDER BY score DESC LIMIT 10,10;
    

    http://dev.mysql.com/doc/refman/5.5/en/select.html

    The two arguments 10,10 are (Offset, Limit) so this will retrieve rows 11-20.
    9,11 Would be required to grab the 10th - 20th rank.

提交回复
热议问题