MySQL Forums
Forum List  »  InnoDB

Re: does NO_ZERO_ON_DATE working bad in 5.1?
Posted by: Rick James
Date: November 19, 2014 04:16PM

Here's a possible clue:
mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00');
+-----------------------------------------------------+
| CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00') |
+-----------------------------------------------------+
| 2004-01-01 22:00:00                                 |
+-----------------------------------------------------+
mysql> SELECT CONVERT_TZ('2004-01-00 12:00:00','+00:00','+10:00');
+-----------------------------------------------------+
| CONVERT_TZ('2004-01-00 12:00:00','+00:00','+10:00') |
+-----------------------------------------------------+
| NULL                                                |
+-----------------------------------------------------+
mysql> SELECT '2004-01-00' + INTERVAL 0 DAY;
+-------------------------------+
| '2004-01-00' + INTERVAL 0 DAY |
+-------------------------------+
| NULL                          |
+-------------------------------+
mysql> SELECT '20061001' + INTERVAL 0 DAY;
+-----------------------------+
| '20061001' + INTERVAL 0 DAY |
+-----------------------------+
| 2006-10-01                  |
+-----------------------------+

In other words, use some function that would not modify the data except to turn it into NULL if appropriate. Try this:
SELECT data + INTERVAL 0 DAY, data FROM MyTable;

Options: ReplyQuote


Subject
Views
Written By
Posted
1531
November 18, 2014 11:05AM
Re: does NO_ZERO_ON_DATE working bad in 5.1?
983
November 19, 2014 04:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.