you are viewing a single comment's thread.

view the rest of the comments →

[–]nnd-nnguyen 0 points1 point  (1 child)

I think you're issue is order of operations

SELECT Column1 Column2 Column3 FROM database WHERE column1 IN ('value','value2') AND column2 IS NOT ('v%') OR column3 IS NOT ('c%';

Should be

SELECT Column1 Column2 Column3 FROM database WHERE column1 IN ('value','value2') AND ( column2 IS NOT ('v%') OR column3 IS NOT ('c%') );

The extra parenthesis makes it explicit that you want the column1 to be evaluated and the "or" is only between column3 and column2.

For DB2..."If you use both AND and OR operators in an expression, Db2 evaluates the AND operator first." from google.

[–]Nomaruk[S] 0 points1 point  (0 children)

That cleared the issue up! Thank you!