title: Find distinct values as per condition in MYSQL and count for the resul in next column PHP
body: <p>I am trying to find a MySQL query that will first find distinct values for a month in a particular field and then count count the number of occurrences of that value in other field and display the result in PHP MySQL</p>
  
  <p>example db</p>
  
  <pre><code>id        Month        task completed   
  ====================================
  vc        02             Yes
  vd        02             Yes 
  ve        02             Yes
  vc        02             Yes
  vc        03             Yes
  vd        03             No
  ve        03             Yes
  </code></pre>
  
  <p>expected result</p>
  
  <pre><code>Month: 02
  
  id count of task competed
  -------------------------
  vc         2
  vd         1 
  ve         1
  </code></pre>
  
  <p>Also there are 100s of ids so specifying one by one is not an option</p>