I am trying to get some rows from SQL and order them by ID. Currently my query is like this:
SELECT * FROM logs ORDER by id ASC;
4 etc etc.
SELECT * FROM logs ORDER by id ASC DESC limit 10
You can use a subquery.
SELECT * FROM ( SELECT * FROM logs ORDER BY id DESC LIMIT 2 ) subquery ORDER BY id ASC
Please note that selecting from subqueries requires an alias (in this case
subquery). Otherwise you'll get error
Every derived table must have its own alias, at least in MySQL.