View Single Post

   
  #3 (permalink)  
Old 04-20-2008, 02:49 PM
Tigger
 
Posts: n/a
Default Re: reversing the order of a limited query

"Captain Paralytic" <paul_lautman@yahoo.com> wrote in message
news:989c7cc7-9b6e-4912-958e-dfbd7ff524ee@y21g2000hsf.googlegroups.com...
> On 17 Apr, 00:21, cami...@mit.edu wrote:
>> I keep track of some documents for work, and have built an rss feed to
>> show the most recent 20. A simplified version of the query is here:
>>
>> SELECT date_created, id, name
>> FROM documents
>> ORDER BY date_created desc
>> LIMIT 0, 20
>>
>> This will show the most recent documents, with the most recent on the
>> top. Is it possible to reverse the order of these last twenty?
>>
>> I'd like to have a list of the most recent documents, ordered ascending.
>>
>> Thanks,
>> Charley

>
> Here is one way:
> SELECT * FROM (
> SELECT date_created, id, name
> FROM documents
> ORDER BY date_created desc
> LIMIT 0, 20 ) AS md
> ORDER BY date_created


How do you read the data?

If its stored in a collection, would it be easy to reverse the order you
iterate it?

--
Tony
http://www.mccreath.org.uk


Reply With Quote