8

我有这个 mySQL 脚本:

SELECT TOP 2 * FROM produse ORDER BY `id_produs` DESC

生成此错误:

#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 '2 * FROM produse ORDER BY `id_produs` DESC LIMIT 0, 30' at line 1

问题是什么?

4

2 回答 2

20

mysql中没有TOP

使用限制 2

   SELECT * FROM produse ORDER BY id_produs DESC LIMIT 2
于 2013-07-06T13:58:47.977 回答
5

改用LIMIT

SELECT * 
FROM   produse
ORDER  BY id_produs DESC
LIMIT  2
于 2013-07-06T13:59:20.347 回答