sql - MySQL: counts by week. -


i group series of counts week. know using week() function returns number week, i'd this:

week                 count(*) jan 1 - jan 7        30 jan 8 - 14           50  , on... 

is there way this? thank much.

select   concat(cast(date_add(yourdate, interval(1-dayofweek(yourdate)) day) char), ' - ', cast(date_add(yourdate, interval(7-dayofweek(yourdate)) day) char)) period, count(*)  tablename  group week(yourdate) 

Comments