I'm writing a program to count attendance, and I have a table (att_events) containing the holidays in this format:
Date | Description | Poster ID
2025-01-01 New Year Admin
by using the following statement:
SELECT MONTH(date) AS month, YEAR(date) AS year, COUNT(date) AS hdays
FROM att_events
WHERE date BETWEEN '2025-02-01' AND '2026-01-31'
GROUP BY MONTH(date) ORDER BY year, month;
I managed to get these data:
month | year | hdays
2 2025 10
3 2025 3
4 2025 1
5 2025 4
6 2025 7
7 2025 1
9 2025 7
10 2025 3
12 2025 8
1 2026 7
Since there is no holidays in August and November, the table is missing rows for month=8 and month=11.
So I'd like to know if there is a way to make the result set to include the missing rows like:
month | year | hdays
...
8 2025 0 <-
9 2025 7
10 2025 3
11 2025 0 <-
...
Thanks in advance.