Leon Noble writes:

> select dayofmonth(date) as mydate, count(num) as mycount from table_name
> where date='TO_DAYS(2001-08-01) - TO_DAYS(2001-08-31)' and action=1 group by
> dayofmonth(date);

This query makes no sense at all. I don't think the date will
ever be equal to that string constant, unless it's the special
0000-00-00. Really, what you want to consider is all dates
between 2001-08-01 and 2001-08-31, right? The why not use
something like WHERE date BETWEEN '2001-08-01 AND '2001-08-31'?

//C

-- 
 Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280
 [EMAIL PROTECTED] | http://pixelmagic.dyndns.org/~cirdan/
 Amiga user since '89, and damned proud of it too.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to