>>>>> "Brian" == Brian Moon <brian@stripped> writes:
Brian> I could not find anything in the archives. I searched for order by ansi sql
Brian> and all the combinations of those words. While I could not find a specific
Brian> ANSI definition of the clause, I found no other db system on the net with
Brian> this behavior. I did find many that had ASC as the default.
Brian> Brian Moon
Brian> -------------------------------------------------------------------------
Brian> Phorum Dev Team - http://www.phorum.org
Brian> Making better forums with PHP
Brian> -------------------------------------------------------------------------
>> > Select * from table order by field1 desc,field2
>> > >How-To-Repeat:
>> > Just use that query.
>> > >Fix:
>> >
>> > Add asc to field 2.
Hi!
MySQL follows ANSI SQL in this case.
Yes, ASC is default but only for the first element! The default sort
order will propagate to the following columns. This means that:
ORDER BY a,b,c,d -> ORDER BY a ASC, b ASC, c ASC, D ASC
ORDER BY a DESC,b,c,d -> ORDER BY a DESC, b DESC, c DESC, D DESC
ORDER BY a DESC,b ASC,c,d -> ORDER BY a DESC, b ASC, c ASC, D ASC
This is described in the change notes for 3.23 and also in the notes
when upgrading from a 3.22 version.
Note that this is actually very logical; If you give DESC for the
first column you probably want everything to be sorted in reverse
order!
Regards,
Monty