I am making a stats program and have run into a slight problem. I'm not even sure if MySQL can do this natively or whether I will need to use some PHP as well.
I have a database with each hit the site has and would like to be able to display graphs for the day/week/month/etc. However, when there are no hits for the day MySQL doesn't return a row for that day (which of course it shouldn't do). Is there any way which I can data for each day, regardless of whether there were any hits or not? The SQL I have at the moment is:
Code: Select all
SELECT FROM_UNIXTIME(date, '%Y-%m-%d') AS `group_date`,
COUNT(*) as 'hits'
FROM `hits`
GROUP BY `group_date`
ORDER BY `group_date` DESC
LIMIT 7