title: How do I select two weeks ago in MYSQL?
body: <p>I have a report that is driven by a sql query that looks like this:</p>
  
  <pre><code>   SELECT batch_log.userid,
           batches.operation_id,
           SUM(TIME_TO_SEC(ramses.batch_log.time_elapsed)),
           SUM(ramses.tasks.estimated_nonrecurring + ramses.tasks.estimated_recurring),
           DATE(start_time)
      FROM batch_log
      JOIN batches ON batch_log.batch_id=batches.id
      JOIN ramses.tasks ON ramses.batch_log.batch_id=ramses.tasks.batch_id
      JOIN protocase.tblusers on ramses.batch_log.userid = protocase.tblusers.userid
     WHERE DATE(ramses.batch_log.start_time) &gt; "2011-02-01" 
       AND ramses.batch_log.time_elapsed &gt; "00:03:00" 
       AND DATE(ramses.batch_log.start_time) &lt; now() 
       AND protocase.tblusers.active = 1
       AND protocase.tblusers.userid NOT in ("ksnow","smanning", "dstapleton")
  GROUP BY userid, batches.operation_id, date(start_time)
  ORDER BY start_time, userid ASC
  </code></pre>
  
  <p>Since this is to be compared with the time from the current payperiod it causes an error.<br>
  Our pay periods start on a Sunday, the first pay period was 2011-02-01 and our last pay period started the 4th of this month. How do I put that into my where statement to strip the most recent pay period out of the query?</p>
  
  <p>EDIT: So now I'm using date_sub(now(), INTERVAL 2 WEEK) but I really need a particular day of the week(SUNDAY) since it is wednesday it's chopping it off at wednesday.</p>