MySQL Get all categories using Cross join
-- Each category with each status will be retrieved using CROSS JOIN (between categories and statuses without any join condition), then the LEFT JOIN for comparing and calculation the actual complaint counts. select c.name as category, ss.name as status, Count(aa.complaint_id) as ComplaintCount from categories c cross join statuses ss left join ( select cc.id as complaint_id, cc.category_id, cc.status_id,cc.consulate_office_id from complaints cc ) aa on aa.category_id=c.id and aa.status_id=ss.id -- and aa.consulate_office_id=12 group by c.name ,ss.name