如何从 mysql table 每次 select 50 行

How to select 50 rows everytime from mysql table

我想每次 select 50 行 table

我写了以下查询

select * from table order by id asc limit 50 ;

现在,我想 select 接下来的 50 条记录,然后是接下来的 50 条记录。

我应该编写什么查询来获取接下来的 50 条记录?

您可以添加一个 offset 子句来指定 return 值的起始位置。例如,在第一个 运行:

select * from table order by id asc limit 50 offset 0; -- Returns rows 1-50

然后:

select * from table order by id asc limit 50 offset 50; -- Returns rows 50-100

以此类推