It's right there in the manual <http://dev.mysql.com/doc/mysql/en/SELECT.html>:

| 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:
|
| SELECT a, COUNT(b) FROM test_table GROUP BY a DESC

Michael

Daniel Kasak wrote:

Hi all.

I've noticed that if I do a 'group by xxx' I get the results sorted by xxx ( when I'm only grouping on 1 field ).
It seems to happen that way every single time.
Is this faster than doing both a 'group by' and 'sort by', and is it something I can rely on?
Just curious...


Dan



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to