Bug #37878 Date/Time comparation using curdate()
Submitted: 4 Jul 2008 15:06 Modified: 4 Aug 2008 15:27
Reporter: Marcos Felipe Zara Zara Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Data Types Severity:S2 (Serious)
Version:5.0.45-community-net OS:Windows (XP)
Assigned to: CPU Architecture:Any

[4 Jul 2008 15:06] Marcos Felipe Zara Zara
Description:
When I do a select comparing a DATETIME field using curdate(), the MySQL returns only the records before a NULL value in the field. No ones records is returned after the NULL Value ... 
Example:

mysql> select ticket, cliente, dataentrada from ticket;
+--------+-------------+---------------------+
| ticket | cliente     | dataentrada         |
+--------+-------------+---------------------+
|      1 | 34094265821 | 2008-07-04 11:23:25 |
|      2 | 34094265821 | 2008-07-04 11:26:02 |
|      3 | 34094265821 | 2008-07-04 11:12:21 |
|      4 | 34094265821 | 2008-07-04 11:31:14 |
|      5 | 34094265821 | 2008-07-04 11:23:25 |
|      6 | 34094265821 | 2008-07-04 11:26:20 |
|     10 | 34094265821 | 2008-07-04 11:08:12 |
|     11 | 34094265821 | 2008-07-04 11:26:25 |
|     12 | 34094265821 | 2008-07-04 11:26:25 |
|     13 | 34094265821 | 2008-07-04 11:26:25 |
|     14 | 34094265821 | 2008-07-04 11:26:25 |
|     15 | 34094265821 | 2008-07-04 11:26:25 |
|     16 | 11075796865 | 2008-07-04 11:26:25 |
|     17 | 11075796865 | NULL                |
|     18 | 11075796865 | 2008-07-04 11:26:25 |
|     19 | 11075796865 | 2008-07-04 11:26:25 |
|     20 | 11075796865 | 2008-07-04 11:26:25 |
|     21 | 11075796865 | 2008-07-04 11:26:25 |
|     22 | 00000001617 | 2008-07-04 11:26:25 |
|     23 | 11075796865 | 2008-07-04 11:26:25 |
|     24 | 00000001623 | 2008-07-04 11:26:25 |
|     25 | 00000001621 | 2008-07-04 11:26:25 |
|     26 | 00000001626 | 2008-07-04 11:26:25 |
|     29 | 00000001625 | 2008-07-04 11:26:25 |
|     30 | 00000001621 | 2008-07-04 11:26:25 |
|     31 | 00000001623 | 2008-07-04 11:26:25 |
|     32 | 00000001621 | 2008-07-04 11:26:25 |
+--------+-------------+---------------------+
27 rows in set (0.00 sec)

Now , I will make a comparation using curdate == Today is 04-07-2008 ==

mysql> select ticket, cliente, dataentrada from ticket where date(dataentrada) =
 curdate()  ;
+--------+-------------+---------------------+
| ticket | cliente     | dataentrada         |
+--------+-------------+---------------------+
|      1 | 34094265821 | 2008-07-04 11:23:25 |
|      2 | 34094265821 | 2008-07-04 11:26:02 |
|      3 | 34094265821 | 2008-07-04 11:12:21 |
|      4 | 34094265821 | 2008-07-04 11:31:14 |
|      5 | 34094265821 | 2008-07-04 11:23:25 |
|      6 | 34094265821 | 2008-07-04 11:26:20 |
|     10 | 34094265821 | 2008-07-04 11:08:12 |
|     11 | 34094265821 | 2008-07-04 11:26:25 |
|     12 | 34094265821 | 2008-07-04 11:26:25 |
|     13 | 34094265821 | 2008-07-04 11:26:25 |
|     14 | 34094265821 | 2008-07-04 11:26:25 |
|     15 | 34094265821 | 2008-07-04 11:26:25 |
|     16 | 11075796865 | 2008-07-04 11:26:25 |
+--------+-------------+---------------------+
13 rows in set (0.00 sec)

Where is my Records??????????
27 rows - 1 row(NULL) = 13 rows  ??????????????????????????????
In the second query, Its should return 26 Rows !! Not only 13 Rows.

How to repeat:
Every TIme
[4 Jul 2008 15:27] Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 5.0.51a at least, and inform about the results.
[4 Aug 2008 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".