title: Count months from datetime in MySQL with years
body: <p>I have been banging my head around trying to come up with a query to display a datetime to show years -> months -> count(months with that year). </p>
  
  <p>Example:
  I want to show my results like this:</p>
  
  <pre><code>Year    Mth     #
  2012    Apr     595
  2012    Mar     27
  2011    Oct     1
  etc...
  </code></pre>
  
  <p>my table looks like this:</p>
  
  <pre><code>create table `log` (
      `datetime` datetime ,
      `username` varchar (75),
      `clientaddr` varchar (225),
      `action` varchar (75),
      `details` varchar (300)
  );
  </code></pre>
  
  <p>I want to show all the records in in the logs table as shown above. Anyone have any suggestions? Feel free to share an algorithm to do the same thing. </p>
  
  <p>Thanks in advance :)</p>