Jump to content

Recommended Posts

Hey,

 

I have a query which orders by in ASC and limits 20, but this is the reverse of what i need as i need the "last 20" rows (the most up to date) but still in ASC order.... currently ORDER ASC LIMIT 20 gets 0 to 20.

 

How can i get the last 20 rows of a result in a query?

Link to comment
https://forums.phpfreaks.com/topic/188826-select-last-x-amount-of-rows/
Share on other sites

You need it in ASC order? Well you can always store the end results in an array and rsort the array:

 

SELECT * FROM table ORDER BY field DESC LIMIT 10

 

Should get you what you want, you will just have to manipulate the data when PHP has it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.