Showing last 5 entries

Hello

I want to display the last five entries however I want it be ordered ASC.

e.g say this is my table data

1,2,3,4,5,6,7,8,9,10

I want it display

6
7
8
9
10

select id, whatever, else, from table
order by id desc
limit 5

then use php to reorder the data when displayed.

Hi thank you for your response. I want to order it ASC and show the last 5 results.

Simply using
“order by id ASC / DESC
limit 5”
will not be the desired result.

please read the last line of dr john’s post

SELECT * FROM
   (SELECT * FROM yourtable
   ORDER BY yourcolumn DESC
   LIMIT 5)
ORDER BY yourcolumn

that needs a table alias, guelphdad :wink:

Don’t you need to distinguish between the 2 yourcolumn references?

… the 2 yourcolumn references?

Hello sorry, i would like to know if it is possible through mysql

SELECT * FROM   
   (SELECT *
   FROM yourtable   
   ORDER BY yourcolumn DESC  
   LIMIT 5) as DT
ORDER  BY yourcolumn