If you want to 'deselect' columns where both conditions are true (ID1
is 4 and ID2
is 7), use something like:
select * from TBL where ID1 <> 4 or ID2 <> 7;
ID1 ID2 selected
--- --- --------
4 7 no
4 1 yes
1 7 yes
1 1 yes
If you want to 'deselect' columns where either condition is true (ID1
is 4 or ID2
is 7), use something like:
select * from TBL where ID1 <> 4 and ID2 <> 7;
ID1 ID2 selected
--- --- --------
4 7 no
4 1 no
1 7 no
1 1 yes
This can be extended to more conditions simply by adding them to the end of the where
clause (and changing both/either
to all/any
in the text).