MySql count with GROUP BY returns 1 even when count is 0
I have two tables in MySql i.e., subjects and photos and I wished to count the number of photos on each subjects SELECT a.id, a.name, count(a.id) as `refcount`, FROM `subjects` a LEFT JOIN `photos` b ON (a.id = b.subject_id) GROUP…