title: MySQL count of value in colum
body: <p>I have one colum <code>package</code> and contain package id <code>1, 2, 3, 4</code>. Right now my query will select all table <code>stores_profile</code> and <code>stores_fee</code> and filter by <strong>date</strong> and group by <strong>month</strong></p>
  
  <p>Below is my database :</p>
  
  <p>Table : stores_profile</p>
  
  <p><img src="https://i.stack.imgur.com/Ed25o.png" alt="enter image description here"></p>
  
  <p>Table : stores_fee</p>
  
  <p><img src="https://i.stack.imgur.com/dRqNx.png" alt="enter image description here"></p>
  
  <p>and here is my current query :</p>
  
  <pre><code>&lt;?php
  $filter_date = '2013-04-01';
  
  $result = mysql_query("SELECT sp.*, sf.*, sp.id as store_profile_id,DATE_FORMAT(sf.date_start, '%d-%m-%Y') as month
   FROM `stores_profile` sp
   left join `stores_fee` sf ON sp.id=sf.store_id 
   where sf.date_start &gt;= '".$filter_date."' GROUP BY MONTH(sf.date_start) ");
  
  while($row = mysql_fetch_array($result)) {
      $month = date('M', strtotime($row['month']));
      $package = $row['package']; 
  ?&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $month ?&gt;&amp;nbsp;&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
  &lt;?php } echo '&lt;/table&gt;'; ?&gt;
  </code></pre>
  
  <p>and result for this code is :</p>
  
  <p><img src="https://i.stack.imgur.com/z3DZl.png" alt="enter image description here"></p>
  
  <p>So, how to count package id in column <code>package</code> then group by month and get total based on package id, i know it's little bit confusing but the result should be like below :</p>
  
  <p><img src="https://i.stack.imgur.com/5Tnfg.png" alt="enter image description here"></p>