I have this query:
SELECT date AS datekey, count(*) AS total
FROM `tags` AS `t`
INNER JOIN `thing_tags` AS `tt` ON `tt`.`tag_id` = `t`.`tag_id`
INNER JOIN `things` AS `th` ON `tt`.`thing_id` = `th`.`thing_id`
WHERE `t`.`other_id` = 14
AND date(`date`) >= '2019-12-20'
GROUP BY datekey
ORDER BY datekey DESC
Which gives me these results:
2022-07-15,8
2022-07-12,16
2022-07-06,10
2022-07-01,3
What I need, is a record for every single day, even if the count is zero:
(record for every day since 2019-12-20)
2022-07-06,10
2022-07-05,0
2022-07-04,0
2022-07-03,0
2022-07-02,0
2022-07-01,3
I was hoping that I could use some kind of date function to create a structure which I can then join to but I can't figure out how to do it.