59.1.3 Query Tutorial: The Conjunction Operators: And, Or, Except
The Query Editor gives you speed, power, and flexibility in querying. A large part of the reason for its power and flexibility is the ability to link query lines together with the query conjunctions And, Or, Except.
Each of these three words has a slightly different use in the Query Editor than the same word has in real life. Let's look at the use of the three words in the Query Editor.
When two query lines are joined by the conjunction And, this means that the query result will be records that have both Condition 1 And Condition 2. For example:
QUERY [Location] AND [Location]Demog_Last_Name #Jones
QUERY [Location] AND [Location]Stay_Days > 10
This query would find only those records that meet both conditions simultaneously.
User Tip: When two query lines are joined by the conjunction And, the resulting current selection of records will always be equal to or smaller than the current selection that would have resulted from just doing one line of the query.
When two query lines have the conjunction Or, this means that the query result will be records that have either Condition 1 Or Condition 2 Or both conditions simultaneously. For example:
QUERY [Location] AND [Location]Demog_Last_Name #Jones
QUERY [Location] OR [Location]Stay_Days > 10
We will find more records with this OR query than we did with the AND query.
User Tip: When two query lines are joined by the conjunction Or, the resulting current selection of records will always be equal to or larger than the selection that would have resulted from just doing one line of the query.
When two query lines have the conjunction Except, this means that the query result will be all records that have Condition 1 - except those records that also have Condition 2. For example:
QUERY [Location] AND [Location]Demog_Last_Name #Jones
QUERY [Location] EXCEPT [Location]Stay_Days > 10
User Tip: When two query lines are joined by the conjunction Except, the resulting current selection of records will always be equal to or smaller than the selection that would have resulted from just doing one line of the query.
As you have seen, the Query Conjunction Operator can make quite a difference in the query result!
|