[thelist] MYSQL: getting distinct dates from a DATETIME field
Joshua Olson
joshua at waetech.com
Thu Oct 2 21:39:39 CDT 2003
----- Original Message -----
From: "rudy" <rudy937 at rogers.com>
Sent: Thursday, October 02, 2003 10:07 PM
> > <tip type="SQL" author="Joshua Olson">
> > If your query has a GROUP BY clause, the SELECT clause
> > can only contain aggregated columns (SUM, MIN, COUNT, etc)
> > or the columns that are in the GROUP BY clause.
>
> once again i must be a nitpicker, sorry
>
> change the word "or" in the above sentence to "and" --
> any difference in meaning?
>
> what about "and/or"?
I think "and/or" is more clear. Thanks. If you were to try to explain the
same rule as clearly and simply as possible, what would you say? This rule
seems to cause a lot of heartache for many SQLers.
> and must the SELECT list contain all the columns in the GROUP BY,
> or can it contain only some of them? none of them?
I'm not clear what prompted this question. Please explain.
> forget for a moment that you and i know the syntax, and
> try to see it through the eyes of someone who does not
I learned that super-simple rule after months and months of not
understanding what the heck the logic was behind the GROUP and SELECT
relationship. I think I understand the viewpoint of "someone who does not"
very well as I was one of them for a long time. :-)
> ... ESPECIALLY someone who has been taught the
> non-standard mysql proprietary extension
This surprises me. The extension that allows the selection of the
non-aggregated columns that are 1-1 to the columns in the GROUP BY requires
quite a few logical hurtles to understand. Anybody who truly understands
that extension and can use it fluently demonstrates a high level of
understanding.
Perhaps you mean the people who accidentially utilize the extension without
understanding why they can select some columns but not others?... you may be
right.
<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168
More information about the thelist
mailing list