日期:2014-05-16  浏览次数:20622 次

MYSQL 分页错误了
mysql> select * from b;
+------+------+-------+
| id | name | bumen |
+------+------+-------+
| 2400 | a | 1 |
| 2300 | b | 1 |
| 2200 | a | 2 |
| 2200 | b | 2 |
+------+------+-------+
4 rows in set (0.00 sec)

mysql> select top 2 * from b order by id;
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 '2 * f
rom b order by id' at line 1


错了

------解决方案--------------------
MySQL 中不是TOP,是LIMIT

SQL code
select  * from b order by id limit 2;