In response to Kai Voigt's post about unxepected results from
dates here is what is going wrong.
To add and subtract time using + and - you need to use the
INTERVAL keyword either before or after the + or - like
so..
mysql> select now() - interval 2 day;
+------------------------+
| now() - interval 2 day |
+------------------------+
| 2006-04-24 07:31:02 |
+------------------------+
1 row in set (0.00 sec)
In Kai's example it's valid to use - on it's own but that handles
the date simply as an integer and subtracts the number specified.
In small cases as in the example this can seem as if it's the
seconds being subtracted but if for example you subtract 100 it
simply reduces the number by that amount and not by 1 minute 40
seconds as it sould for a date type.
[Read more]
mysql> select now() - 100 day, now(); …