tags:

views:

50

answers:

1

Hi,

I want to select the last three rows of a table in ascending order. How the query should be for that?

Thanks

+5  A: 

SELECT * FROM table ORDER BY DESC LIMIT 3

kgb
Logically the last three rows for a column in ASC order would be the first three in DESC order. +1 kgb
Jason McCreary
this way you are going to get the right rows, 3 rows is not much to sort not using mysql
kgb
then, "SELECT * FROM table ORDER BY ASC LIMIT (FOUND_ROWS() - 3), 3" should work for you(though i didn't test it ;) )
kgb