Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>DATE</code> comparisons are very likely what you want here. If your from_date column has the data type of <code>DATE</code>, then your code should be safe and robust if you do this:</p> <pre><code>WHERE from_date = STR_TO_DATE('06/11/2012', '%m/%d/%Y') </code></pre> <p>@Repox pointed out that you might consider putting your date literals in the canonical format '2012-06-11'. That's true, if you can do it. But STR_TO_DATE will do it for you if you need it to. There's a list of the %x conversion items here. <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format</a></p> <p>If you're using <code>DATETIME</code> data types, beware: comparisons are more complex than they seem. <code>DATETIME</code> items are like floating point numbers: if one of them exactly equals another it's only by coincidence. That's because they represent moments (milliseconds) in time, not just days.</p> <p>Presuming your from_date column has the <code>DATETIME</code> type, you should use</p> <pre><code>WHERE from_date &gt;= STR_TO_DATE('06/11/2012', '%m/%d/%Y') AND from_date &lt; STR_TO_DATE('06/11/2012', '%m/%d/%Y') + INTERVAL 1 DAY </code></pre> <p>This will catch all moments in time on the day you want, up to but not including the first moment of the next day.</p> <p>If your from_date items are represented as character strings, take the trouble to convert them to <code>DATE</code> or <code>DATETIME</code> data types. Seriously. Your results will be far better.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload