title: How do I compare overlapping values within a row?
body: <p>I seem to have a problem with this SQL query:</p>
  
  <pre><code>SELECT * FROM appts 
  WHERE timeStart &gt;='$timeStart' 
  AND timeEnd &lt;='$timeEnd' 
  AND dayappt='$boatdate'
  </code></pre>
  
  <p>The time is formatted as military time. The logistics is that a boat rental can be reserved at 7am til 1pm or 9am til 1pm or 9am til 5pm. If there is an appt within that range, it should return appts but it has proven to be inconsistent. If I pick 9am til 1pm, it will ignore appts that started with 7am even though it overlaps 9am-1pm. If I pick 9 to 5, it will return nothing even though it should with the 7am to 1pm. How do I make a SQL statement that includes the whole range from timeStart to timeEnd including those that overlap?  </p>