Jump to content

Getting the most recent X entries, but shown in reverse order


mb81

Recommended Posts

Hello all,

 

I have a query where I need to get the 10 most recently added lines in a particular MySQL table, but I need to process them starting at the oldest of the 10.

 

Is there a way to reverse the order it returns the rows if I am using a datetime field in DESC order to sort them?

 

I thought about running the whole query, getting the number of rows, and then doing another query to limit to the last 10.

 

I also thought about running the query, then seeking to the 10th to the last row and going from there.

 

Are there any other suggestions or some magic syntax I am missing?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.