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
( 0 <= x ) <= 30
and ( 0 <= x ) evaluates to either 1 or 0, depending on whether it's
true, so it's always less than 30, so the whole expression is always
true.
What you mean is
WHERE TO_DAYS(NOW()) - TO_DAYS(StartDate) 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]