Weird problem with WHERE DATE(datetimefield)=something

    Date: 06/26/08 (MySQL Communtiy)    Keywords: mysql, database, sql

    I have two RHEL5 machines, both built & configured at the same time. Both have MySQL 5.0.45 installed and share an identical database.

    So - this query returns 334 on one machine, and 0 on the other:

    • SELECT COUNT(*) FROM mytable WHERE DATE(datetimefield) = '2008-05-05';

    I put that in red, since it seems to be where the problem is. The strange thing is that both machines returned 334 yesterday.

    If I change the query (on the supposed broken box) to this:

    • SELECT COUNT(*) FROM mytable WHERE datetimefield LIKE '2008-05-05%';

    I get 334.

    I realize there several ways of doing this, but I'm more interested in why, out of nowhere, MySQL decides not to allow WHERE DATE(datetimefield)=blah anymore.

    Ideas?

    Source: http://community.livejournal.com/mysql/130037.html

« Selective Replication in... || Memory leak? »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home