title: How to count each month without repeating the lines?
body: <p>I'm trying to create all months in a query instead of use several lines.</p>
  
  <p>Here is the information:</p>
  
  <pre><code>CREATE TABLE quotes (
    id INT,
    created_at DATE,
    num_policy INT);
  
  INSERT INTO quotes VALUES
   (   1,     '2014-01-01',1234),      
   (   2,     '2014-02-06',5678),  
   (   3,     '2013-04-24',9123), 
   (   4,     '2013-05-24',4567),
   (   5,     '2014-06-20',8912);
  </code></pre>
  
  <p>I tried this query:  <a href="http://sqlfiddle.com/#!2/2f4f51/5" rel="nofollow">http://sqlfiddle.com/#!2/2f4f51/5</a></p>
  
  <pre><code>SET @year := 2014;
  
  SELECT count(*) AS jan FROM `quotes` WHERE (created_at BETWEEN CONCAT( @year, "-01-01") AND CONCAT( @year, "-01-31")) ;
  SELECT count(*) AS feb FROM `quotes` WHERE (created_at BETWEEN CONCAT( @year, "-02-01") AND CONCAT( @year, "-02-29")) ;
  ......
  
  SELECT count(*) AS dem FROM `quotes` WHERE (created_at BETWEEN CONCAT( @year, "-12-01") AND CONCAT( @year, "-12-31")) ;
  </code></pre>
  
  <p>I'm trying to show all months in one line</p>
  
  <pre><code>  |jan|  |feb|  |mar|  |apr| ......
      1       1      0     0
  </code></pre>
  
  <p>Please somebody can help me?</p>
  
  <p>I will appreciate all kind of help.</p>