gpt4 book ai didi

MySQL:限制 2,-1

转载 作者:行者123 更新时间:2023-11-30 22:39:21 25 4
gpt4 key购买 nike

$sql="SELECT * FROM `table_name` LIMIT 1,-1";

为什么我收到错误报告:

SELECT * FROM `table_name` LIMIT 2,-1

MySQL 说:文档

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1

最佳答案

来自 https://dev.mysql.com/doc/refman/5.0/en/select.html

The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants (except when using prepared statements).

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;

所以在你的情况下

$sql="SELECT * FROM table_name LIMIT 1,18446744073709551615";

关于MySQL:限制 2,-1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31531089/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com