58.1.5 Query Tutorial: Query Order and Set Theory
The answer to the Or puzzle lies in Set Theory. STATIC relies heavily on mathematical Set Theory. Graphically, we could represent the three sets as:
Set Theory: A Graphical Explanation
Let's use these three graphical representations to understand how 4D interprets the query conjunctions AND, OR, and EXCEPT.
The conjunction AND tells 4D to do an intersection of the two sets. The word intersection means exactly what you think it means: find the place where the two sets intersect; that is, find the records that the two sets have in common.
The conjunction OR tells STATIC to do a Union of the sets. The word Union means exactly what you think it means: Join the sets together. If a record is in either set, it will be in the result set.
If a record is a member of either set, then it is counted as a part of the result. However, if a record is a member of more than one of the united sets, the record is still only counted once.
The conjunction EXCEPT tells STATIC to do a Difference of the two sets, but only put into the result set the records in set A that are not in set B. So that you will understand EXCEPT, here is a graphic example:
|