I have a payments table grouped by day
select
day(created),
sum(payments.amount)
from payments
group by day(created)
output
day | amount
1 | 432
2 | 4567
5 | 345
6 | 2345
7 | 97
which is fine, but i'd like to put some 0
in the days which did not have payments.
expected output:
day | amount
1 | 432
2 | 4567
3 | 0
4 | 0
5 | 345
6 | 2345
7 | 97