This is experimental functionality, and as such subject to change. Use at your own risk!
AND to NOT IN
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
A concatenation of AND predicates combining non-equalities that always use the same operand on one side can be replaced by a more concise, but equivalent NOT IN predicate.
Using Settings.transformPatternsAndNeToNotIn
, the following transformations can be achieved:
-- With Settings.transformPatternsAndNeToNotIn active, this: SELECT * FROM tab WHERE x != 1 AND x != 2 AND x != 3; -- ... is transformed into the equivalent expression: SELECT * FROM tab WHERE x NOT IN (1, 2, 3);
See also OR to IN
Feedback
Do you have any feedback about this page? We'd love to hear it!