|
发表于 2007-9-21 12:40:47
|
显示全部楼层
ms不可以;
直接写在select里是必须要正数的,手册里有说明,若出现负数则直接提示语法错误;
在prepare statement的语法中,允许定义负数,但返回结果为空。
eg:
mysql>select * from EMP limit -1,5;
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,5' at line 1
mysql>set @a=-1; set @b=5;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> prepare stmt from 'select * from EMP limit ?,?';
Query OK, 0 rows affected (0.01 sec)
Statement prepared
mysql> execute stmt using @a,@b;
Empty set (0.00 sec)
mysql> |
|