I want to fetch data weekwise for the particular month.
ex: if i select may month . i need count of first week,count of second week ,count of third week and so on
I want to fetch data weekwise for the particular month.
ex: if i select may month . i need count of first week,count of second week ,count of third week and so on
use the following query.
select
concat(year(date_format(timefield, '%Y-%m-%d')), ' week ', substring_index(dayofyear(date_format(timefiels, '%Y-%m-%d'))/7+1, '.', 1)) as time,
sum(sales) as sales
from
account
where
timefield>='2014-05-01 00:00:00'
and timefield<='2014-05-31 23:59:59'
group by
time;