title: MySQL query for booking. How to allow two reservations on the same date (check-in/check-out)
body: <p>I'm trying to get all the room booked between two dates.<br>
  I'm using this query right now but I'm having an issue with it. I tried many thing, did a lot of search but after some hours I deciced to try to ask here for help.</p>
  
  <pre><code>SELECT 1 FROM reservations WHERE
  checkin &lt;= '$check_out' AND checkout &gt;= '$check_in'
  </code></pre>
  
  <p>Let's say someone book 21st to 22nd.<br>
  He check-in on 21st at 4:00PM and check-out on 22nd at 12:00PM<br>
  The room is still free on 21st before 4:00PM<br>
  The room is still free on 22nd after 12:00PM  </p>
  
  <p>With this query, I can't book 20th to 21st<br>
  Check-in 20th at 4:00PM, check-out 21st at 12:00PM</p>
  
  <p>I also can't book 22nd to 23rd.</p>
  
  <p>Any idea how to adjust the query to reflect that reality?</p>
  
  <p>There is also that query:</p>
  
  <pre><code>(checkin &lt;= '$check_in' AND checkout &gt;= '$check_in') OR
  (checkin &lt;= '$check_out' AND checkout &gt;= '$check_out') OR
  (checkin &gt;= '$check_in' AND checkout &lt;= '$check_out')
  </code></pre>
  
  <p>You can refer to this question, this is where I took my queries:
  <a href="https://stackoverflow.com/questions/8914457/checking-for-date-range-conflicts-in-mysql">Checking for date range conflicts in MySQL</a></p>
  
  <p>Thanks a lot!</p>