Hello,

Any idea why the following doesn't work?  It's taken from the MySQL manual
which says it should return records in the last 30 days.  As you can see,
I'm getting records spanning some 19 months from last May to December
2004...

mysql> SELECT StartDate FROM Events
    -> WHERE TO_DAYS(NOW()) - TO_DAYS(StartDate) <= 30;
+----------------+
| StartDate      |
+----------------+
| 20041226000000 |
| 20030721000000 |
| 20030806000000 |
| 20030926000000 |
| 20030510000000 |
| 20030630000000 |
| 20030517000000 |
| 20031017000000 |
| 20030507000000 |
| 20030707000000 |
| 20030510000000 |
| 20030517000000 |
| 20030510000000 |
| 20030515000000 |
| 20030628000000 |
| 20030706000000 |
| 20030803000000 |
+----------------+
17 rows in set (0.01 sec)

Thanks very much for any advice!

Trevor

Reply via email to