title: Count the output rows of an sql query?
body: <pre><code>SELECT 
      `list_type`.`type`
  FROM
      `events`
          INNER JOIN
      `list_type` ON `events`.`type` = `list_type`.`id`
  WHERE
      `events`.`date` BETWEEN '2012-01-01' AND '2012-12-31'
          AND `events`.`center_id` = 2
  GROUP BY `events`.`name`
  
  Baseline
  Baseline
  Baseline
  Baseline
  Baseline
  Baseline
  Baseline
  Special Events
  Special Events
  Special Events
  </code></pre>
  
  <p>But I would like it to count each type like this</p>
  
  <pre><code>Baseline    7
  Special Events  3
  </code></pre>
  
  <p>so i tried this</p>
  
  <pre><code>SELECT 
      `list_type`.`type`,
      COUNT(*)
  FROM
      `events`
          INNER JOIN
      `list_type` ON `events`.`type` = `list_type`.`id`
  WHERE
      `events`.`date` BETWEEN '2012-01-01' AND '2012-12-31'
          AND `events`.`center_id` = 2
  GROUP BY `events`.`name`
  </code></pre>
  
  <p>But it gives me this:</p>
  
  <pre><code>Baseline    45
  Baseline    3
  Baseline    56
  Baseline    23
  Baseline    12
  Baseline    9
  Baseline    2
  Special Events  5
  Special Events  4
  Special Events  18
  </code></pre>
  
  <p>It is counting the number of each name and type not the output form query.
  I also tried COUNT(<code>list_type</code>.<code>type</code>) 
  Thanks for your help.</p>