title: mySQL between dates that span over multiple years
body: <p>Hi I was wondering why this statement is working in mySQL</p>
  
  <pre><code>SELECT COUNT(*) AS `numrows` 
  FROM (`myTable`) 
  WHERE DATE_FORMAT(creationDateTime, '%m/%d/%Y') BETWEEN '02/21/2011' AND '03/20/2011'
  </code></pre>
  
  <p>but this is not</p>
  
  <pre><code>SELECT COUNT(*) AS `numrows` 
  FROM (`myTable`) 
  WHERE DATE_FORMAT(creationDateTime, '%m/%d/%Y') BETWEEN '12/21/2010' AND '03/20/2011'
  </code></pre>
  
  <p>The first statement returns 'xx' count of the number of rows while the second one returns '0'</p>
  
  <p>The only difference I see is that the "from" date is in 2010 and the "end" date is in 2011. To test if this was the problem I queried from '12/31/2010' and it still gave me 0 results but when I set the start date as '01/01/2011' it gave me the number of records that were created in that time span.</p>
  
  <p>Is there something I am missing with regards to mySQL's BETWEEN and using dates from different years?</p>
  
  <p>Thanks for the help!</p>