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=arch...@jab.org

Reply via email to