[thelist] MySQL GROUP BY Anomaly?

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


I have 2 tables with RecordDate in them, one has millions of records, one
has hundreds of records. If I perform the following query on the table with
hundreds;

mysql> select RecordDate
    -> from tblInfo
    -> WHERE RecordDate BETWEEN '2002-03-04' AND '2002-03-06'
    -> GROUP BY RecordDate;

I get three rows back in the result;

+------------+
| RecordDate |
+------------+
| 2002-03-04 |
| 2002-03-05 |
| 2002-03-06 |
+------------+

but if I run this query against the table with millions of records I get (a
small snippet of the results)

| 2002-03-06 |
| 2002-03-05 |
| 2002-03-06 |
| 2002-03-05 |
| 2002-03-06 |
| 2002-03-05 |
| 2002-03-06 |
| 2002-03-05 |
| 2002-03-04 |
+------------+
34164 rows in set (17.78 sec)

Can anyone enlighten me as to what is happening? Both tables are on the same
machine, but the one with millions of records is a MERGE table. If I run the
query against the individual tables in the merge, they return the proper (3
row) result.

Thanks!

Jay





More information about the thelist mailing list