sql - MySQL Date Range -
i have automated query counts number of searches made each week, @ moment showing month search took place in, show date range of respective week showing data for, i.e 30/09/13 - 07/10/13
my query:
select count(*) `count`, `region`, monthname(`date`) `month` stores.stats `date` > date_add(date (now()), interval - 1 week) , `date` < date (now()) group `region`, month(`date`);
just add range select list, so:
select count(*) `count`, `region`, monthname(`date`) `month`, date_add(date (now()), interval - 1 week) `range start`, date (now()) `range stop` stores.stats `date` > date_add(date (now()), interval - 1 week) , `date` < date (now()) group `region`, month(`date`)
Comments
Post a Comment