You're using incorrect syntax for date math. Use: CURDATE() - INTERVAL 1 day
See the manual for details. -----Original Message----- From: Ted Maas [mailto:tm...@uic.edu] Sent: Friday, October 01, 2010 7:47 AM To: mysql@lists.mysql.com Subject: possible curdate() issue This is most likely user error but I noticed today that when I subract 1 from the curdate() function I get a very interesting result: mysql> select curdate() - 1 from dual; +---------------+ | curdate() - 1 | +---------------+ | 20101000 | +---------------+ 1 row in set (0.00 sec) curdate() itself is OK: mysql> select curdate() from dual; +------------+ | curdate() | +------------+ | 2010-10-01 | +------------+ 1 row in set (0.00 sec) These also seem somewhat strange: mysql> select curdate() - 70 from dual; +----------------+ | curdate() - 70 | +----------------+ | 20100931 | +----------------+ 1 row in set (0.00 sec) mysql> select curdate() - 71 from dual; +----------------+ | curdate() - 71 | +----------------+ | 20100930 | +----------------+ 1 row in set (0.00 sec) I use the curdate() - 1 to pick up yesterdays date from an index. On Sept. 30 the code worked OK. Today ... not so much. Since this behavior is the same on MySQL 4.1.22, 5.0.77 and 5.1.36 I must be doing something wrong. Any Ideas? Ted Maas Research Programmer Systems Group Academic Computing and Communications Center University of Illinois at Chicago -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=gto...@ffn.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee, you are notified that reviewing, disseminating, disclosing, copying or distributing this e-mail is strictly prohibited. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any loss or damage caused by viruses or errors or omissions in the contents of this message, which arise as a result of e-mail transmission. [FriendFinder Networks, Inc., 220 Humbolt court, Sunnyvale, CA 94089, USA, FriendFinder.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org