How to set up grouped conditions
Grouped Conditions: Example
To learn about grouping conditions, look at this example:
Suppose you want to find the names of members who live in the 48189 or 48300 zip code area but who also reside within the Whitmore Lake city limits.
This example is quite simple, but there are times when manually writing the structure of the where clause can be helpful so you can see what information you need and how you want the conditions to be grouped.
Inside the brackets, we have two conditions separated by the or operator. If a record satisfies either of these conditions, it passes the first check. To be included in the result set, however, the record must also satisfy the AND condition. So, as this example shows, you can use the or operator to provide options and combine those options with the restrictive nature of the and operator to make your queries a little more robust.
Setting Up Grouped Conditions
The following instructions show you how to set up the grouped conditions in the previous example.
-
In the Query Conditions panel, click (Group Conditions button).
As shown in the following illustration, this clause appears under the Select records statement: any of the following apply.
2. Because the any keyword has an "or" meaning, leave the added clause as is.
3. Add the first grouped condition. To do this, complete the following:
a. Click the Batches Actual Cash Total link. From the list, select Members > Contact Info > Home Zip.
b. Click the starts with link. Then, from the list, select is equal to.
c. Click the [enter value] link and type 48108 in the text field.
4. Add the second grouped condition. To do this, complete the following:
a. Click . From the list, select Members > Contact Info > Home Zip.
b. Click the starts with link. Then, from the list, select is equal to.
c. Click the [enter value] link and type 48300 in the text field.
-
Add the AND condition. To do this, complete the following:
a. Click the Add new condition link. From the list, select Members > Contact Info > Home City.
The system adds the condition. Note that the keyword and precedes the condition.
b. Click the starts with link. Then, from the list, select is equal to.
c. Click the [enter value] link and type Whitmore Lake in the text field.
The query conditions setup now looks like this: