Hi All,

Tried the following three statements and they are wither too slow or do not
give me what I want. Basically what I want is to search for records for a
whole month and display totals for that month for each individual day. The
date field is indexed.

Tried......

select count(num) as mycount from table_name where month(date) = 08 and
year(date) = 2001 and action = 1 group by dayofmonth(date);

this one takes too long........


As does this one.....

select dayofmonth(date) as mydate, count(num) as mycount from table_name
where month(date)=08 and year(date)=2001 and action=1 group by
dayofmonth(date);


and this one just outputs the total figure for the month

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);


can anyone help to point me in the right direction.

many thanks


Leon.


---------------------------------------------------------------------
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