MySQL限制/偏移:获取除前一个X之外的所有记录

时间:2022-09-22 15:41:40

I want to query all records from number 50 and up. So instead of doing something like LIMIT 49, 99999 I want to know if there is an official way.

我想查询从第50条开始的所有记录。我想知道是否有一个正式的方法。

1 个解决方案

#1


14  

No, sorry. From the MySQL Documentation:

不,对不起。从MySQL文档:

To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:

要从某个偏移量检索到结果集末尾的所有行,可以为第二个参数使用某个较大的数字。此语句检索第96行到最后一行的所有行:

SELECT * FROM tbl LIMIT 95,18446744073709551615;

#1


14  

No, sorry. From the MySQL Documentation:

不,对不起。从MySQL文档:

To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:

要从某个偏移量检索到结果集末尾的所有行,可以为第二个参数使用某个较大的数字。此语句检索第96行到最后一行的所有行:

SELECT * FROM tbl LIMIT 95,18446744073709551615;