Im making a SELECT
query for two tables.
Tables:
- ec_events
- ec_calendar
Select QUERY:
SELECT MONTH(`ec_calendar`.`Day`) AS Month ,COUNT(`ID_Event`) AS Count
FROM `ec_events`,`ec_calendar`
WHERE `ec_events`.`FK_Day`=`ec_calendar`.`ID_Day` AND YEAR(`ec_calendar`.`Day`) = 2015
GROUP BY MONTH(`ec_calendar`.`Day`)
And the result:
The only problem here is May (5. month). On the result image you can see, that was ignored, because in ec_calendar
is no entry for this month. Many times better will be, if 0 could be returned. So the table will loks so:
....
3 15
4 7
5 0
6 10
7 3
...
Is there any way to provide it?