title: Mysql datetime between two columns
body: <p>I've got two columns (both datetime) startDate and endDate in an events table.
  I am retrieving the current day using the the <code>date()</code> function of php.</p>
  
  <p>This results in for example 2013-03-12.</p>
  
  <p>Now there are three possibilities of events combined with dates that occur today:</p>
  
  <ol>
  <li>An event starts and also end on this day</li>
  <li>An event has started earlier and ends today</li>
  <li>An event starts today but ends in the future (>= 2013-03-13)</li>
  </ol>
  
  <p>Now I'd like to break these all into separate queries as I'm not used to work with dates. I started with the first query, but I am already failing on that one. I've tried the following:</p>
  
  <pre><code>SELECT * FROM events WHERE (startDate= '2013-03-12' AND endDate= '2013-03-12')
  </code></pre>
  
  <p>aswell as:</p>
  
  <pre><code>SELECT * FROM events WHERE NOT (startDate &lt; '2013-03-12' OR endDate &gt; '2013-03-12')
  </code></pre>
  
  <p>I've tried to use <code>DATE()</code> aswell and to format dates like '2013-03-12%'.</p>
  
  <p>I don't know why it doesn't work while i am sure there is at least 1 event that is taking place on the 12th. Any help is appreciated.</p>