On 6 Jun 2003 at 20:34, Trevor Sather wrote: > 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)
Most of your dates are in the future, so they'll give negative results for the calculation, which are less than 30. You're getting what you asked for: everything starting from 30 days ago. You said nothing about stopping with today, or wherever you're intending to stop. Perhaps you want to change "<= 30" to "BETWEEN 0 AND 30". -- Keith C. Ivey <[EMAIL PROTECTED]> Tobacco Documents Online http://tobaccodocuments.org -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]