Including records based on a combination of search conditions
This section describe how to include records in the results recordset based on a combination of search conditions. You combine search conditions in SQL using the AND , OR , and NOT logical operators.
If you want all the conditions to be true for a record to be included in the recordset, use the AND operator as follows:
...WHERE LASTNAME LIKE 'varLastName' AND DEPARTMENT LIKE 'varDept'
If you want any one of the conditions to be true for a record to be included in the recordset, use the OR operator as follows:
...WHERE LASTNAME LIKE 'varLastName' OR DEPARTMENT LIKE 'varDept'
If you want one condition to be true but not another, use the NOT operator as follows:
...WHERE DEPARTMENT LIKE 'varDept' NOT COUNTRY LIKE 'varCountry'
You can use parentheses to group search conditions: |