TOP and ORDER BY sql error
mysql, sql
Solution
you have an invalid sql syntax. use LIMIT instead
try this:
SELECT id
FROM table
ORDER BY id DESC
LIMIT 1
the `TOP` clause works on MSSQL server.
Problem
I am trying to select the last record from a table in MySQL using PHP. I believe I have an SQL error. Here is my SQL code: ``` SELECT TOP 1 id FROM `table` ORDER BY id DESC ``` If this is valid and I actually have a PHP error, tell me.