mysql 的limit 问题
我就想知道limit的第二个参数 到底可不可以为 -1
limit 10,-1 是不是能查出从10到最后一条
网上的帖子都说可以, 但是在客户端测试确实不行
高手请给出确切答案
不行报错
mysql> select * from uc_pms limit 10,-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 #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 3
SELECT *
FROM `movie_busi_cart`
LIMIT 10 , -1
确实不能 如果要用到最后几条记录 可以加个order by主键嘛 desc limit n 你这是不看文档的结果
http://dev.mysql.com/doc/refman/5.5/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, with these exceptions:
Within prepared statements, LIMIT parameters can be specified using ? placeholder markers.
Within stored programs, LIMIT parameters can be specified using integer-valued routine parameters or local variables as of MySQL 5.5.6.
页:
[1]