How to get last 10 records from sql table in ascending order

select top(10) from customer order by customer_id desc
+3
source share
4 answers
select * 
from (select top 10 * from customer order by customer_id desc) a
order by  customer_id
+9
source

This work works fine in MS SQL, but for MySQL we have to go SELECT * FROM customer ORDER BY customer_id DESC LIMIT 10

+2
source

It seems you are missing the list of columns that you want to get from the table.

Consider:

select top(10) 
*
from customer order by customer_id desc

or

select top(10) 
customer_id, customer_name
from customer order by customer_id desc
+1
source

you can use: SELECT * FROM customer ORDER BY customer_id DESC LIMIT 10

-1
source

Source: https://habr.com/ru/post/1723401/


All Articles