I'm trying this query
SELECT date_trunc('day', commit_at) AS day, count(*)
FROM commits
GROUP BY date_trunc('day', commit_at)
ORDER BY date_trunc('day', commit_at) ASC;
and it return
day | count
---------------------+-------
2015-05-18 00:00:00 | 5
2015-05-19 00:00:00 | 2
2015-05-21 00:00:00 | 2
(3 lignes)
The question is: How I can force empty days to be in the results ?
day | count
---------------------+-------
2015-05-18 00:00:00 | 5
2015-05-19 00:00:00 | 2
2015-05-20 00:00:00 | 0
2015-05-21 00:00:00 | 2
(3 lignes)
generate_seriesbetween first and last date then query theses dates ? I tried that but I can't have something working, if someone have an examplegenerate_series