Guys, how to display the last 10 messages from the top down?
SELECT * FROM Messages ORDER BY id DESC LIMIT 5 Displays the last 10 messages, but I need to top down that would display.
Guys, how to display the last 10 messages from the top down?
SELECT * FROM Messages ORDER BY id DESC LIMIT 5 Displays the last 10 messages, but I need to top down that would display.
In my opinion, to flip user output in a sql query, this is a pretty weary way of handling data, but nonetheless:
SELECT * FROM ( SELECT * FROM Messages ORDER BY id DESC LIMIT 5 ) AS t1 ORDER BY id; IMHO, it is more logical to prepare data for output to the user on the client side. For this is the function Array.prototype.reverse .
Source: https://ru.stackoverflow.com/questions/584106/
All Articles