Bug #16256 | A problem with MySQL ordering based on dates | ||
---|---|---|---|
Submitted: | 6 Jan 2006 16:10 | Modified: | 12 Feb 2006 16:13 |
Reporter: | Rohan Abraham | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | MySQL 5.0.17nt | OS: | Windows (Windows XP) |
Assigned to: | CPU Architecture: | Any |
[6 Jan 2006 16:10]
Rohan Abraham
[8 Jan 2006 11:08]
Valeriy Kravchuk
Thank you for a problem report. Please, send the results of SHOW CREATE TABLE invoice. Some sample data to demonstrate a problem will be useful too.
[12 Jan 2006 16:13]
Valeriy Kravchuk
Sorry, but I was not able to repeat the problem you described with 5.0.19-BK on Linux with a simple test case: mysql> CREATE TABLE `invoice` ( -> `Invoice_ID` int(11) NOT NULL auto_increment, -> `Invoice_Date` datetime default NULL, ... -> KEY `ContractIDDate` (`Contract_ID`,`Invoice_Date`) -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Query OK, 0 rows affected (0.05 sec) mysql> insert into invoice(Invoice_Date) values (now()); Query OK, 1 row affected (0.01 sec) ... mysql> insert into invoice(Invoice_Date) values ('0000/00/00'); Query OK, 1 row affected (0.00 sec) ... mysql> insert into invoice(Invoice_Date) values ('2006/01/03'); Query OK, 1 row affected (0.00 sec) mysql> SELECT Invoice_ID, Invoice_Date, DATE_FORMAT( Invoice_Period_Start, '%d/%m/%Y' ) -> as Invoice_Period_Start, -> DATE_FORMAT( Invoice_Period_End, '%d/%m/%Y' ) as Invoice_Period_End, -> DATE_FORMAT(Invoice_Date, '%d/%m/%Y') as Invoice_Date_Display, -> Invoice_Number -> FROM invoice -> order by Invoice_Date DESC; +------------+---------------------+----------------------+--------------------+ ----------------------+----------------+ | Invoice_ID | Invoice_Date | Invoice_Period_Start | Invoice_Period_End | Invoice_Date_Display | Invoice_Number | +------------+---------------------+----------------------+--------------------+ ----------------------+----------------+ | 3 | 2006-01-12 18:59:22 | NULL | NULL | 12/01/2006 | NULL | | 2 | 2006-01-12 18:59:21 | NULL | NULL | 12/01/2006 | NULL | | 1 | 2006-01-12 18:59:19 | NULL | NULL | 12/01/2006 | NULL | | 8 | 2006-01-03 00:00:00 | NULL | NULL | 03/01/2006 | NULL | | 7 | 2006-01-02 00:00:00 | NULL | NULL | 02/01/2006 | NULL | | 6 | 2006-01-01 00:00:00 | NULL | NULL | 01/01/2006 | NULL | | 4 | 0000-00-00 00:00:00 | NULL | NULL | 00/00/0000 | NULL | | 5 | 0000-00-00 00:00:00 | NULL | NULL | 00/00/0000 | NULL | +------------+---------------------+----------------------+--------------------+ ----------------------+----------------+ 8 rows in set (0.00 sec) mysql> SELECT Invoice_ID, Invoice_Date, DATE_FORMAT( Invoice_Period_Start, '%d/ %m/%Y' ) as Invoice_Period_Start, DATE_FORMAT( Invoice_Period_End, '%d/%m/%Y' ) as Invoice_Period_End, DATE_FORMAT(Invoice_Date, '%d/%m/%Y') as Invoice_Date_D isplay, Invoice_Number FROM invoice order by Invoice_Date; +------------+---------------------+----------------------+--------------------+ ----------------------+----------------+ | Invoice_ID | Invoice_Date | Invoice_Period_Start | Invoice_Period_End | Invoice_Date_Display | Invoice_Number | +------------+---------------------+----------------------+--------------------+ ----------------------+----------------+ | 4 | 0000-00-00 00:00:00 | NULL | NULL | 00/00/0000 | NULL | | 5 | 0000-00-00 00:00:00 | NULL | NULL | 00/00/0000 | NULL | | 6 | 2006-01-01 00:00:00 | NULL | NULL | 01/01/2006 | NULL | | 7 | 2006-01-02 00:00:00 | NULL | NULL | 02/01/2006 | NULL | | 8 | 2006-01-03 00:00:00 | NULL | NULL | 03/01/2006 | NULL | | 1 | 2006-01-12 18:59:19 | NULL | NULL | 12/01/2006 | NULL | | 2 | 2006-01-12 18:59:21 | NULL | NULL | 12/01/2006 | NULL | | 3 | 2006-01-12 18:59:22 | NULL | NULL | 12/01/2006 | NULL | +------------+---------------------+----------------------+--------------------+ ----------------------+----------------+ 8 rows in set (0.00 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.0.19 | +-----------+ 1 row in set (0.00 sec) So, it is either some problem in your table or the bug (if any) is already fixed. Please, try to CHECK your table or to repeat with a newer version, 5.0.18, just as I demonstrated. Inform about the results.
[13 Feb 2006 0:02]
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".