This is my query:
SELECT count(*) as total, dp.name,dp.id,dp.description, dp.avatar FROM `doctors` d right join departments dp on d.department_id = dp.id group by d.department_id
I have to tables: doctors and departments. I want to extract the total number of doctors from each department. This query works fine, it returns me all of the deparments, which have a doctors, but not which does not have. Somehow I want to show all of the departements and a total, which represents the doctors whose belong to a department. How can i do that ?