In order to perform a conditional query you can use the SQL NOT
operator. In this example where you have multiple conditionals that must be satisfied it may make more sense to use the NOT IN
operator with a list of values that must be satisfied.
Examples
NOT
SELECT * FROM table WHERE NOT id = 'A' AND NOT id = 'B';
More examples - W3Schools
NOT IN
SELECT * FROM table WHERE id NOT IN ('A', 'B');
More examples - W3Resource
Also if depending on how you determined which values you need to exclude (if you query to find them for example) you can either nest the Not In with a query or take a look at this stack overflow solution - Not-in-vs-Not-Exists