Query logic? question

  • Thread starter Thread starter Junior
  • Start date Start date
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?
 
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)
 
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)
 
Back
Top