Quantcast
Channel: MYSQL select table by desc order limiting from last 10 rows - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Tim Biegeleisen for MYSQL select table by desc order limiting from last 10 rows

$
0
0

Use a subquery here to get the final reverse ordering you want:

SELECT *FROM(    SELECT *     FROM comments     WHERE chat_id = 1    ORDER BY comment_id DESC  -- last 10 rows    LIMIT 10) tORDER BY comment_id;          -- in ascending order

Viewing all articles
Browse latest Browse all 3

Trending Articles