I am using a query as follows.
SELECT * FROM TableName
WHERE ([Material Description] Not Like "*LICENSE*" Or
[Material Description] Not Like "*LICENCE*");
However, this fetches me results having records with LICENCE or LICENSE in the Material Description field. Please advise as to what is that I am missing so that my query yields me result omitting the records containing these words in the Material Description field.
What you actually want is
AND
in between:You will currently select the record "LICENSE" because it does NOT contain "LICENCE" and the record "LICENCE" because it does NOT contain "LICENSE".
The records you currently really exclude are the ones which contain "LICENCE" AND "LICENSE", probably not many ;). That little confusion arises from the usage of Or in combination with Not.
Another way to achieve the same goal would be to move the
NOT
in front of theOR
ed condition:That way it is a little bit clearer what you actually want to achieve.
This will read
NOT (A OR B)
as opposed to(NOT A) OR (NOT B)
and has very different truth table:Your truth table would look like