对行排序,然后从这个集合中得到特定的10行


Ordering rows and then getting a particular 10 rows from that set

我有一个保存用户在游戏中获得的点数的数据库表,它看起来像这样:


id点1000
300
600
900

我希望能够得到第50到59个点最多的行。如果需要多个查询,这是可以的。我使用PHP和MySQL。谢谢!

$query = "SELECT *
          FROM table_name
          ORDER BY points DESC
          LIMIT 49,10";
$result = mysqli_query($link, $query);
while ($row = mysqli_fetch_assoc($result)) {
  // Do stuff here
}
select * from table order by points desc limit 49,10

你可以试试

select id,points from table order by points desc limit 49,10;