I am trying to create a graph that will show the last 30 days. I have the query and it is working, but since we have just started we only have the dates from today onways, What I would like to do is have 30 days in the past also return with the date and total will be 0.
Is there anyway to do this with MYSQL? My Current Query.
SELECT COUNT(DISTINCT(sessionkey)) as total, stamp as day,
ROUND(UNIX_TIMESTAMP(stamp)/(60 * 60)) AS timekey
FROM analytics
WHERE stamp > date_sub(now(), interval 30 day)
GROUP BY timekey