I am trying to gather statistics about a database that I am working with, I want to know how many entries were made in the database per month, I’m stuck because the timeframe is longer than one year, e.g. it starts in Feb 2010 and ends at the present.
Right now I am trying to do something like this:
startDate = `mysql -h <hostname> -u root -D build -e "select MIN(submittime) '
Start Date' from builds;"`
endDate = `mysql -h <hostname> -u root -D build -e "select MAX(submittime) 'En
d Date' from builds;"`
months = []
months.push(`mysql -h <hostname> -u root -D build -e "select count(id)
from builds where submittime >= startDate
and submittime <= date_add(startDate, interval 30 DAY);"`
etc…
Any help/ideas would be great.
Thanks.
add GROUP BY MONTH(submittime).