Well, when I do this query:
select to_days(now()) - to_days('2004122600');
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()) -
Because now - a future date is a negative number, and therefore 30.
Trevor Sather wrote:
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
At 20:34 +0100 6/6/03, Trevor Sather wrote:
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...
The example
Thanks very much (to all who replied) -- this looks good!
Best wishes
-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]
Sent: 06 June 2003 20:46
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Help with Date Range Query
At 20:34 +0100 6/6/03, Trevor Sather wrote
On 6 Jun 2003 at 20:34, Trevor Sather wrote:
mysql SELECT StartDate FROM Events
- WHERE TO_DAYS(NOW()) - TO_DAYS(StartDate) = 30;
++
| StartDate |
++
| 2004122600 |
| 2003072100 |
| 2003080600 |
| 2003092600 |
| 2003051000 |
On 6 Jun 2003 at 13:43, Mike Hillyer wrote:
SELECT StartDate FROM Events
WHERE 0 = TO_DAYS(NOW()) - TO_DAYS(StartDate) = 30;
I don't think that's doing what you think it is. In math notation =
can be chained that way, but not in most programming languages.
0 = x = 30
is equivalent to
Aah, I stand corrected. Friday afternoon is not my best day to be
answering questions on here. ;)
Regards,
Mike Hillyer
www.vbmysql.com
-Original Message-
From: Keith C. Ivey [mailto:[EMAIL PROTECTED]
Sent: Friday, June 06, 2003 1:59 PM
To: [EMAIL PROTECTED]
Subject: RE: Help with Date