6. MICROSOFT ACCESS QUERIES – ADVANCED
6.2.2: In
The IN operator can be used if you need to determine if a field value is in a specific list of values. The list of values is a comma-separated list enclosed in parentheses; for example (1, 3, 6)
Example
To list those courses offered by the Physics, Statistics and Mathematics departments you need a list of values: (“PHYS”, “STAT”, “MATH”)
Using QBE we code IN (“PHYS”, “STAT”, “MATH”) in the criteria line:
Note: using IN is equivalent to using three simple logical expressions that are ORed, and is a convenient way of expression if there are several values in the list:
Exercises
Develop queries to:
1) List courses offered by Physics or Applied Computer Science where the course description contains the word computer.
2) List courses where the course description contains the word computer but where the course is not offered by the Applied Computer Science department.
3) List courses where the credit hours are 1, 3, 6 or 9.
4) List courses where the credit hours are not 1, not 3, not 6, and not 9.