mysql limit错误错在哪里?
MySQL 5.6.12
select * from table limit 1,-1 ;
ERROR 1064 (42000): 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,1'
at line 1
好吧,看来MySQL是不支持 -1参数了。
多谢各位。
结贴。
你写的到底是 select * from table limit 1,-1 ;
还是 select * from table limit -1,1 ;
???
SELECT * FROM Table LIMIT 1, -1;
全换成正数试试。
...
-1mysql是不识别的
MySQL是支持LIMIT带负数参数的。语法是:
LIMIT {[offset,] row_count | row_count OFFSET offset}
(来自 dev.mysql.com/doc)貌似 5.6不再支持负数参数了。
我贴上的错误报告可能贴错了,(向兔子党-督察道歉)
再三测试,仍然是那个错误
mysql> select * from Blabla limit 1,-1;
ERROR 1064 (42000): 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
select * from table limit 1,-1;
意思是:1表示查询起始位置,-1表示查询条数;所以,两个位置都不能为负