I need to query a table with a filtering condition on three columns:
select *
from table a
where a.order = car
and a.color !=red
or a.automatic !=auto
This just checks the first conditions and ignores the second one.
I just can’t get my head around it 🙁
Its not clear from your question but all you probably need is to wrap parens around your OR condition
Given this following table and rows
This select statement will return records 2, 3 and 4 since they are all cars and are either blue or manual
Demo
Another option is to do the following using De Morgan’s law “The negation of a disjunction is the conjunction of the negations.”
Demo