[thelist] MySQL GROUP BY Anomaly?

Jay Blanchard jay.blanchard at niicommunications.com
Thu May 9 13:13:12 CDT 2002

Check the "time" portion of the date field.  My bet is that each of the
records is indeed unique if you account for date and time.  Grouping by date
is sorta rough.  You'll either want to GROUP BY on a function of RecordDate
that normalizes the values to midnight, or create a view that normalizes the
RecordDate field to midnight and then run your query against the view.

The syntax of the normalizing function will greatly depend on what the
database has to offer.  And, I'm no MySQL guru... so, good luck.

The date is the only thing entered here, so all of the times are
00:00:00:00. Also, if the time was a factor it would blow up when I select
the entire range of dates in the database, but that works. I only get the
problem when I select a narrower range of dates than the entire databse, or
when I select one date.Heck, when I SELECT DISTINCT RecordDate from the
table, that gives me back the dates more than once too. I have a feeling it
has something to do with it being a merged table...but what?



More information about the thelist mailing list