I need to create a query that selects data that is like one set of criteria
but not like that criteria along with others. This is so confusing to me that
I cannot even phrase the question properly. Here is an example:
Field1 like 'A' but not like 'A' and 'B' and 'C'
This is indeed confusing! Could you post an example of real data which
would be selected - and some which would not?
As phrased no records could ever be selected, because it impossible
for a value to be equal to A and also not equal to A. For that matter,
no field can ever be equal to 'A' and 'B' and 'C'. Since you're not
using wildcards in your criterion, the LIKE operator is being treated
exactly the same as the = operator.
Just a sidebar here: a query's WHERE clause in SQL must be a logical
expression which evaluates to either TRUE or FALSE. The operators
"AND" and "OR" look like the English language conjunctions, but they
really aren't: they are Boolean operators, just as + and - are
arithmatic operators. Both of them take two arguments, one on the left
and one on the right:
A AND B is True if A is a True statement and B is also True
it is False if either A or B is False
A OR B is True if A is a true statement, or if B is a true
statement, or if both are true statements
it is False if A and B are both False statements
So the expression 'A' AND 'B' will *always be true* - because any
nonzero value is True, only a numeric 0 is False.
John W. Vinson[MVP]