title: How to join Count(*) columns with another column in Mysql
body: <p>I have a table like this</p>
  
  <p>The first table is the "Appointments" table with 'doctor_id' the second table is the "Doctors" table also with 'doctor_id'. The duplicate values from the appointments table represents how many appointment each doctor has. for example the doctor_id(50) has 6 appointments.</p>
  
  <pre><code>doctor_id(Appointments)   |  doctor_id(Doctors)
            50              |         50
            50              |         51
            50              |         52
            52              |         53
            50              |
            50              |
            52              |
            53              |
            50              |
  </code></pre>
  
  <p>Now, my question is how would I show this table below (ps excluding the doctor id '51)</p>
  
  <pre><code>doctor_id (Doctors) |  Count
          50          |    6
          52          |    2
          53          |    1
  </code></pre>
  
  <p>This what i have tried so far, i have managed to work out how many doctors have appointments
  using : </p>
  
  <pre><code>SELECT COUNT(*) FROM appointment 
  WHERE doctor_id &gt; 50
  </code></pre>
  
  <p>I have executed other queries as well but with no luck.</p>