|
Posted by Andy Hassall on 06/28/05 22:59
On 28 Jun 2005 12:52:48 -0700, "frizzle" <phpfrizzle@gmail.com> wrote:
>Short question:
>Is there any way, to reverse the result of a mysql query?
>
>Explanation:
>If i have eg. 20 records, all with their own id of course,
>select 5 with limit, and order them DESC by ID, it should give
>me: 20, 19, 18, 17, 16. That's all ok.
>But now i want 16 to appear first, 17 second, etc.
Depends on which version of MySQL. If it's recent, have the original query as
a subquery, with the outer query re-ordering by ID.
If not recent, fetch all the records into a PHP array and reverse the array.
http://php.net/array
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
[Back to original message]
|