I'm trying to get the COUNT of all users attempts by a list of the current week (last 7 days)
This query works but doesnt return 0 if the day not exist:
SELECT COUNT(*) AS attempt_count,
DATE_FORMAT(attempt_date,'%Y/%m/%d') AS attempt_date
FROM users_attempts
WHERE DATE_SUB(attempt_date, INTERVAL 1 DAY) > DATE_SUB(DATE(NOW()), INTERVAL 1 WEEK)
GROUP BY DAY(attempt_date) DESC;
This query return the COUNT of all attempts of the last current week per day, i got this (I only have 1 record):
attempt_count | attempt_date
1 2014/06/19
I want this result:
attempt_count | attempt_date
1 2014/06/19
0 2014/06/18
0 2014/06/17
0 2014/06/16
0 2014/06/15
0 2014/06/14
0 2014/06/13
Many thanks