Patrick (patrickwonders) wrote,
Patrick
patrickwonders

  • Mood:

MySQL

mysql> SELECT NOW(), start, end FROM `table` WHERE ( NOW() BETWEEN start AND end );
Empty set (0.09 sec)

mysql>  SELECT NOW(), start, end FROM `table` WHERE ( DATE( NOW() ) BETWEEN start AND end );
+---------------------+------------+------------+
| NOW()               | start      | end        |
+---------------------+------------+------------+
| 2006-10-03 15:56:14 | 2005-11-01 | 2006-11-01 | 
+---------------------+------------+------------+
1 row in set (0.00 sec)

So, "2006-10-03" is between "2005-11-01" and "2006-11-01", but "2006-10-03 15:56:14" is not??? Whose idea was that???

Tags: bug, geek
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 7 comments