Kevin wrote:
When I run the query (please see below) between 08:30:00 and 17:29:59, I
get the data from row 1; if I run the same query between 17:30:00 and
08:29:59, I get the "empty set."
Can anyone explain why?
See
http://dev.mysql.com/doc/mysql/en/Co...Operators.html
In general, the expression:
expr BETWEEN min AND max
is defined as being equivalent to:
min <= expr AND expr <= max
So in your case, you're seeing it fail on:
start <= CURRENT_TIME() AND CURRENT_TIME() <= end
which cannot be true if start > end.
Try this:
CURRENT_TIME() BETWEEN LEAST(start, end) AND GREATEST(start, end)
Bill K.