MySQL Forums
Forum List  »  InnoDB

Re: Problem with ORDER BY
Posted by: Roland Bouman
Date: June 30, 2005 05:50PM

Not a transaction post.

Anyway, see the manual for SELECT syntax 13.1.7

If you use GROUP BY, output rows are sorted according to the GROUP BY columns as if you had an ORDER BY for the same columns. MySQL has extended the GROUP BY clause as of version 3.23.34 so that you can also specify ASC and DESC after columns named in the clause:

As you are ordering over computed aggregates, it will prbably not work for you. Try something like this instead:

select *
from (
select c1, agg1,agg2
..
..
group by number ASC
)
order by number, agg1, agg2

Options: ReplyQuote


Subject
Views
Written By
Posted
3021
April 17, 2005 09:32AM
Re: Problem with ORDER BY
1908
June 30, 2005 05:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.