我有这个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
有什么问题?
答案 0 :(得分:18)
mysql中没有TOP
使用LIMIT 2
SELECT * FROM produse ORDER BY id_produs DESC LIMIT 2
答案 1 :(得分:5)
改为使用LIMIT
:
SELECT *
FROM produse
ORDER BY id_produs DESC
LIMIT 2