title: mysql get current week, spanning last year and this year
body: <p>I need to fetch all records from current week. But since Monday Dec 31st was in 2012, mysql treats it as week 53, instead of week 1 of 2013. How can I get around that?</p>
  
  <p>Query:</p>
  
  <pre><code>SELECT COUNT(*) AS `cnt`
  FROM `orders`
  WHERE WEEK(`date_purchased`, 1) = WEEK(NOW(), 1)
      AND (
             (
              MONTH(`date_purchased`) = MONTH(NOW() - INTERVAL 1 WEEK)
              AND YEAR(`date_purchased`) = YEAR(NOW() - INTERVAL 1 WEEK)
              )
          OR (
              MONTH(`date_purchased`) = MONTH(NOW())
              AND YEAR(`date_purchased`) = YEAR(NOW())
              )
          )
  </code></pre>