Query logic? question

J

Junior

trying to query records in a large database and find records matching the
autonumber of the record and a class ID and training date range in another
field

When i use 5 or 8 or 689 or 890 the query returns records .
If i try 5 and 8 and 689 and 890 no records are returned - although i know
these persons attended the class.
What is the proper way to query to find all (from these) persons who
attended?
 
R

Rob Oldfield

The logic is applied for each row of the table. So if you have a criteria
of 5 and 8 then it's looking for a row where the autonumber is 5 and is also
8.... which is obviously impossible. You are looking for any row where the
ID is EITHER 5 or 8 which is why the Or version is working.

The best way of doing it is to use In. Try a criteria of In (5,8,689,890)
 
J

Junior

thanks Rob
Rob Oldfield said:
The logic is applied for each row of the table. So if you have a criteria
of 5 and 8 then it's looking for a row where the autonumber is 5 and is
also
8.... which is obviously impossible. You are looking for any row where
the
ID is EITHER 5 or 8 which is why the Or version is working.

The best way of doing it is to use In. Try a criteria of In (5,8,689,890)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top