title: Count records per month
body: <p>I'm trying to count the number of appointments in each month for the year of 2014, where the date formatting is like '22-JAN-14' 
  I've tried variations of these two codes so far and both come up with "YEAR": invalid identifier.</p>
  
  <p>CODE 1</p>
  
  <pre><code>SELECT count(*), MONTH(dateofappointment) as month, YEAR(dateofappointment) as year
  FROM appointment
  GROUP BY month
  HAVING YEAR(dateofappointment) ='14'
  ORDER BY month;
  </code></pre>
  
  <p>and CODE 2</p>
  
  <pre><code>select count(*)
  from appointment
  group by month(dateofappointment)
  having year(dateofappointment) = '14';
  </code></pre>
  
  <p>Any help is appreciated.</p>