title: MySQL Time and Date query problems
body: <p>I want to make a query which returns me some values between two dates and two times...</p>
  
  <p>The DATE and TIME values are in different columns, DATE is called FECHA and TIME is called HORAIN</p>
  
  <p>I have 4 possible values with just a DATE query:</p>
  
  <p>Value 1 has Date 2012-05-07 time 02:45:00
  Value 2 has Date 2012-05-07 time 12:00:00
  Value 3 has Date 2012-05-08 time 04:35:00
  Value 4 has Date 2012-05-08 time 07:30:00</p>
  
  <p>What I want to get, is the results from 07:00:00 to 23:59:59 from the first day, and values from 00:00:00 to 06:59:59 from the second day (so an interval from 07 AM to 06:59 AM)</p>
  
  <p>This is my query, which is returning NO VALUES... It must return me VALUE 2 and VALUE 3, because it matches my desired requirements</p>
  
  <pre><code>SELECT * FROM mytable
  WHERE
  (DATE(fecha)&gt;='2012-05-07' AND TIME(horain)&gt;='07:00:00')
  AND
  (DATE(fecha)&lt;='2012-05-08' AND TIME(horain)&lt;='06:59:59');
  </code></pre>
  
  <p>What am I doing wrong? :(</p>