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

rudy rudy937 at rogers.com
Thu Jul 17 20:38:00 CDT 2003


> Given that all databases work differently, do you think it would
> still be a good idea to explicitly provide an ORDER BY?

yes, if you need a specific order, you have to ask for it

sometimes it doesn't matter, and you can take results in whatever order they
come

for example, without an ORDER BY, you'll often get results in clustering
index order

> 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?

yes, you would expect so, eh?

although if i were writing an optimizer, which i hasten to add i have no
hope of ever getting a chance to do, i would certainly employ some analysis
of both clauses to see if it were possible to do the grouping of column
values in the same sequence as the sorting for the ORDER BY

the ORDER BY sequence is set in stone, but it doesn't matter what sequence
the grouping occurs, right?


rudy



More information about the thelist mailing list