如何从MySQL中的第x行开始获取所有行 [英] How to get ALL rows starting from row x in MySQL

查看:115
本文介绍了如何从MySQL中的第x行开始获取所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中,如何检索表中从X行开始的所有行?例如,从第6行开始:

In MySQL, how can I retrieve ALL rows in a table, starting from row X? For example, starting from row 6:

LIMIT 5,0

这什么都不返回,所以我尝试了:

This returns nothing, so I tried this:

LIMIT 5,ALL

仍然没有结果(sql错误).

Still no results (sql error).

我不是在寻找分页功能,而是从特定行开始检索所有行. LIMIT 5,2000在我看来似乎太过分了. Google似乎无法以某种方式得到我一些答案.希望能对您有所帮助.

I'm not looking for pagination functionality, just retrieving all rows starting from a particular row. LIMIT 5,2000 seems like overkill to me. Somehow Google doesn't seem to get me some answers. Hope you can help.

谢谢

推荐答案

根据文档:

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

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:

SELECT * FROM tbl LIMIT 95, 18446744073709551615;

这是MyISAM表最多可以容纳的最大行,2 ^ 64-1.

This is the maximum rows a MyISAM table can hold, 2^64-1.

MyISAM表中的行数限制为2 ^ 32(〜4.295E + 09).如果使用--with-big-tables选项构建MySQL,则行限制将增加到(2 ^ 32)^ 2(1.844E + 19)行.请参见第2.16.2节典型配置选项".使用此选项构建用于Unix和Linux的二进制发行版.

There is a limit of 2^32 (~4.295E+09) rows in a MyISAM table. If you build MySQL with the --with-big-tables option, the row limitation is increased to (2^32)^2 (1.844E+19) rows. See Section 2.16.2, "Typical configure Options". Binary distributions for Unix and Linux are built with this option.

这篇关于如何从MySQL中的第x行开始获取所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆