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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

javascript - Backbone.js getting target attribute -

html - Repeat image to extend header to fill screen -