title: How to sort by month in MySQL
body: <p><a href="http://sqlfiddle.com/#!2/8b9a4/10/0" rel="nofollow">Here is demo</a></p>
  
  <p>The order is November and October. How can I add ORDER BY to this, so that the order is by month, Jan, Feb, Mar...etc.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>CREATE TABLE `hw_homework` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `studentid` int(10) NOT NULL,
    `subjectid` int(10) NOT NULL,
    `assignment_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `teacherid` int(10) NOT NULL,
    `date` date NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=55 ;
  
  --
  -- Dumping data for table `hw_homework`
  --
  
  INSERT INTO `hw_homework` (`id`, `studentid`, `subjectid`, `assignment_name`, `teacherid`, `date`) VALUES
  (52, 56, 13, '1A', 20, '2012-10-28'),
  (53, 56, 6, '12', 18, '2012-10-28'),
  (54, 56, 4, 'page42', 59, '2012-11-02');
  
  
  SELECT  studentID, 
          DATE_FORMAT(`date`,'%M') `month`,
          COUNT(studentid) totalMissed
  FROM hw_homework
  WHERE studentid = 56
  GROUP BY studentid, DATE_FORMAT(`date`, '%M')
  </code></pre>