RE: date-IFNULL-sum bug?
2012/10/08 14:52 -0700, Rick James Do not use + for DATE arithmetic! Use, for example + INTERVAL 1 YEAR No, those operations are well defined. Amongst the timestamp-functions there is constant reference to numeric context, and character context--and well there is, because there are no time-constants, only numerals and character strings taken for timestamps. It is also the only means of doing some things. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
RE: date-IFNULL-sum bug?
Do not use + for DATE arithmetic! Use, for example + INTERVAL 1 YEAR -Original Message- From: h...@tbbs.net [mailto:h...@tbbs.net] Sent: Thursday, October 04, 2012 9:35 PM To: mysql@lists.mysql.com Subject: date-IFNULL-sum bug? Can anyone explain this to me? The first one seems quite wrong; the rest make perfect sense. mysql select ifnull(date('1900/5/3'), date('1900/01/01')) + 1; +--+ | ifnull(date('1900/5/3'), date('1900/01/01')) + 1 | +--+ |11900 | +--+ 1 row in set (0.00 sec) mysql select ifnull(date('1900/5/3'), date('1900/01/01')); +--+ | ifnull(date('1900/5/3'), date('1900/01/01')) | +--+ | 1900-05-03 | +--+ 1 row in set (0.00 sec) mysql select date('1900/5/3') + 1; +--+ | date('1900/5/3') + 1 | +--+ | 19010503 | +--+ 1 row in set (0.00 sec) mysql select date(date('1900/5/3') + 1); ++ | date(date('1900/5/3') + 1) | ++ | 1901-05-03 | ++ 1 row in set (0.00 sec) (5.5.8 under muSoft Windows) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
date-IFNULL-sum bug?
Can anyone explain this to me? The first one seems quite wrong; the rest make perfect sense. mysql select ifnull(date('1900/5/3'), date('1900/01/01')) + 1; +--+ | ifnull(date('1900/5/3'), date('1900/01/01')) + 1 | +--+ |11900 | +--+ 1 row in set (0.00 sec) mysql select ifnull(date('1900/5/3'), date('1900/01/01')); +--+ | ifnull(date('1900/5/3'), date('1900/01/01')) | +--+ | 1900-05-03 | +--+ 1 row in set (0.00 sec) mysql select date('1900/5/3') + 1; +--+ | date('1900/5/3') + 1 | +--+ | 19010503 | +--+ 1 row in set (0.00 sec) mysql select date(date('1900/5/3') + 1); ++ | date(date('1900/5/3') + 1) | ++ | 1901-05-03 | ++ 1 row in set (0.00 sec) (5.5.8 under muSoft Windows) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql