title: SQL Select between?
body: <p>I'm making a booking system for holidays for a friend.</p>
  
  <p>When he enters a holiday I need to check if the dates are already in use, if they are then obviously it cannot create the booking.</p>
  
  <p>I'm currently using:</p>
  
  <pre><code>SELECT * 
  FROM anqehxy1kxmeowpcoqjj 
  WHERE `from` BETWEEN '2013-01-16' AND '2013-01-23'
  
  SELECT * 
  FROM anqehxy1kxmeowpcoqjj 
  WHERE `to` BETWEEN '2013-01-16' AND '2013-01-23'
  </code></pre>
  
  <p>to see if I can book a holiday from 2013-01-16 until 2013-01-23.</p>
  
  <p>in the database there is already a booking taken for 2013-01-15 until 2013-01-22 which means that the dates I am trying to book are already taken; however the sql returns 0 rows unless I use the exactly the same dates as what are already in use.</p>
  
  <p>Any ideas on how I can fix this?</p>
  
  <p>As a note, people leave at 10am and the next people arrive at 2pm.</p>
  
  <p>So if two consecutive weeks are booked it would look like </p>
  
  <pre><code>2013-01-14 -&gt; 2013-01-21 
  2013-01-21 -&gt; 2013-01-28
  </code></pre>