...

View Full Version : ORDER BY DESC LIMIT Question



StanLytle
07-26-2007, 10:05 PM
ORDER BY .... DESC LIMIT 4

I understand how this works. It returns the last, in this case 4, whatevers. Is there a way to get the next to the last 4? In other words, in a table that has 100 rows, could this be written to return rows 93-96, instead of 97-100. This is a dynamic table, where the row numbers are incremented as more information is added.

Thanks,
Stan

StanLytle
07-26-2007, 10:22 PM
I found my answer, I just hadn't looked enough. The solution to my question is:

DESC LIMIT 4, 4

For others that may be looking for help, this example returns 4 whatevers, starting 4 from the last. The first 4 (after DESC LIMIT) is the number to return. The second 4 is the starting point.

Stan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum