I have a table (temessage) with a column called eme_last_send of type
DATETIME.
The table in the case below only contain one row with today's date.
I use the CAST function to remove the time fields:
mysql> SELECT CAST(eme_last_send AS DATE),CURRENT_DATE FROM temessage WHERE
CAST(eme_last_send AS DATE)<> CURRENT_DATE;
+-----------------------------+--------------+
| CAST(eme_last_send AS DATE) | CURRENT_DATE |
+-----------------------------+--------------+
| 2003-11-26 | 2003-11-26 |
+-----------------------------+--------------+
However, I did NOT expect this row to appear in this query! It seems like
CAST(eme_last_send AS DATE) is not the same as CURRENT_DATE?
Workaround:
mysql> SELECT CAST(eme_last_send AS DATE),CURRENT_DATE FROM temessage WHERE
LEFT(eme_last_send,10)<>CURRENT_DATE;
Empty set (0.00 sec)
mysql>
This should be easily reproducible and I think this is a bug.
-Joacim