[thelist] CF & SQL: Selecting unique months from date column

Joshua Olson joshua at waetech.com
Thu Jul 17 20:09:12 CDT 2003


----- Original Message ----- 
From: "rudy" <rudy937 at rogers.com>
Sent: Thursday, July 17, 2003 8:12 PM


> > Why is the ordering in the GROUP BY clause important in this query?
>
> short answer:  it isn't
>
> long answer:  because all other things being equal -- i know, i know,
> sometimes they aren't -- the GROUP BY sequence of columns is the sort
order
> the groups will be returned in
>
> saves an explicit ORDER BY

Rudy,

I was afraid you were going to say something like that.  Given that all
databases work differently, do you think it would still be a good idea to
explicitely provide an ORDER BY?

> occasionally this can make a big difference in performance of large
queries

Do you mean that if you do a GROUP BY with the columns in one order, and
then have the ORDER BY in another order, that in some cases the results will
need to be resorted by the database?  That does indeed sound like a "good to
know, let me file that away" sort of thing.

Thank you!

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168



More information about the thelist mailing list