Reputation: 149
I have this mySQL script:
SELECT TOP 2 * FROM produse ORDER BY `id_produs` DESC
Generates this error:
#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
What is the problem?
Upvotes: 9
Views: 7437
Reputation: 10003
Use LIMIT
instead:
SELECT *
FROM produse
ORDER BY id_produs DESC
LIMIT 2
Upvotes: 5
Reputation: 37233
there is no TOP in mysql
use LIMIT 2
SELECT * FROM produse ORDER BY id_produs DESC LIMIT 2
Upvotes: 25