MySQL “between” clause not inclusive?
From the MySQL-manual: This is equivalent to the expression (min <= expr AND expr <= max)
From the MySQL-manual: This is equivalent to the expression (min <= expr AND expr <= max)
With dates (and times) many things become simpler if you use >= start AND < end. For example: SELECT user_id FROM user_logs WHERE login_date >= ‘2014-02-01’ AND login_date < ‘2014-03-01’ In this case you still need to calculate the start date of the month you need, but that should be straight forward in any number … Read more
The BETWEEN operator is inclusive. From Books Online: BETWEEN returns TRUE if the value of test_expression is greater than or equal to the value of begin_expression and less than or equal to the value of end_expression. DateTime Caveat NB: With DateTimes you have to be careful; if only a date is given the value is … Read more