Answer the question
In order to leave comments, you need to log in
How to get last x rows from mysql?
Hello!
I have the following table in the database:
I saw in Google that you can query the last x rows by id, but I don’t have an id field, can I use the DATETIME field instead?
Thanks in advance for the
UPD answer.
The query returns 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 'DESC BY `Date` LIMIT 10' at line 1
UPD2. The solution I found on the
Request structure had to be done a little different:
SELECT * FROM 'table_name' ORDER BY 'Дата' DESC LIMIT 10;
Answer the question
In order to leave comments, you need to log in
SELECT * FROM `имя_таблицы` ORDER BY `Дата` DESC LIMIT 10;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question