MySQL query issue

This is my query:

  SELECT count(*) as total,,,dp.description, dp.avatar 
  FROM `doctors` d  
  right join departments dp on d.department_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 ?

Source: mysql

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.