Search This Blog

Friday, April 29, 2011

[Mysql] Query to get data for the last 7 days

Here's how to extract the data using mysql: (it's very easy)


select date(creationdate),count(*) from content where date(creationdate) between date_sub(curdate(),interval 7 day) and date_sub(curdate(),interval 1 day) group by date(creationdate);


The above query gives you count for last 7 days


Read further about date_sub @

No comments:

Post a Comment