Anda menggunakan LEFT JOIN
, tetapi dalam pernyataan where Anda menjadikannya JOIN
'normal'
Coba tulis seperti ini:
SELECT months_tbl.month, COUNT( events_tbl.appt_id ) cnt
FROM months_tbl
LEFT JOIN events_tbl ON (months_tbl.month_id = MONTH(events_tbl.appt_date_time)
AND events_tbl.company_id = 1
)
GROUP BY months_tbl.month
ORDER BY months_tbl.month_id ASC;
Perhatikan AND events_tbl.company_id = 1
ada di LEFT JOIN