Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Repeatable in mysql-5.1,5.5, maria 5.1, 5.2, 5.5. The following query:
SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
returns NULL even though there are obviously rows that match the WHERE predicate.
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
test case:
CREATE TABLE t1 (a int, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;