title: SQL query to check a date 2 weeks from today
body: <p>We have a booking form, where users can book for several tours and for several tour dates. An order is created after they book and is set to 'pending' state. We want to process the order exactly 2 weeks before the tour date.</p>
  
  <p>We wrote a cron job function and its intended purpose is to get all the orders which are in 'pending' state and there is exactly 2 weeks time for the tour date.</p>
  
  <p>This is the query</p>
  
  <pre><code>$orders = $wpdb-&gt;get_results("SELECT o.*, b.departure_point, b.tour_date, b.tour_id FROM ".CT_TOUR_BOOKINGS_TABLE." b JOIN ".CT_ORDER_TABLE." o ON o.id = b.order_id WHERE o.status = 'pending' AND NOW( ) + INTERVAL 2 WEEK = b.tour_date");
  </code></pre>
  
  <p>The above line is not working, as we did some trial bookings. Is there anything wrong with the statement</p>
  
  <pre><code>"NOW( ) + INTERVAL 2 WEEK = b.tour_date"
  </code></pre>
  
  <p>Thanks for help.</p>