Well, when I do this query: select to_days(now()) - to_days('20041226000000');
I get -569, which is much less than 30, any date in the future will be negative. You may want to do this if you are looking for this style of query: SELECT StartDate FROM Events WHERE 0 <= TO_DAYS(NOW()) - TO_DAYS(StartDate) <= 30; Regards, Mike Hillyer www.vbmysql.com -----Original Message----- From: Trevor Sather [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2003 1:34 PM To: [EMAIL PROTECTED] Subject: Help with Date Range Query 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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]