There is my query:
SELECT DATE_FORMAT(post_date, '%Y-%m-%d') AS data_day
, COUNT(*) AS count
FROM wpsa_posts
WHERE post_date >= DATE_ADD(CURDATE(),INTERVAL -7 DAY)
GROUP
BY data_day
ORDER BY data_day DESC
LIMIT 7
THERE IS THE RESULT OF THE QUERY LIKE THAT:
IF I PUT LAST 30 DAYS THIS GONNA BE LIKE
I want to show all the dates if i put 7(appear the last 7 days and if have nothing on this day appear 0 on count)
Example like i want: i want to show all dates like that example:
data_day || count ||
2018-08-07 || 0 if nothing on this day
2018-08-08 || 32
2018-08-09 || 1
2018-08-10 || 4
2018-08-11 || 0
2018-08-12 || 0
2018-08-13 || 0
i want to show like that