When building a query, there are two main ways to join multiple parameters together: “And” and “Or.”

Using “And” means that records must meet all of the listed criteria in order to be included in results. For example, you may want to find all Contacts who have given a total of at least $1000 life to date that are NOT Tagged as a Major Donor. In this case, you want records that meet both criteria, so you’d use “And” to join these parameters together, and build a query that says “Life to Date Giving Greater than or equal to $1000 and Tag Is none of Major Donor.”

“Or” allows for more flexibility: to be included in results, records must only match to one parameter OR the other. We could use this in a query to identify Major Donors, looking for Contacts who have given a total of at least $1000 life to date or a single gift of at least $500.

When clicking on the “Or” button, you’ll notice that a new list of query parameters, called a query group, is created. In some cases, this might be tricky, as you may have only one “Or” combined with a list of “Ands” in a single query. For example, You might want to look for all Contacts with a Type of Household who have given a total of at least $1000 life to date and who have been donors for at least 2 years, and you should probably take Passthrough giving into account, not just direct giving. We can query for the combined total of direct and Passthrough giving by using the “Life to date plus passthrough giving” statistic, and use “And to add Contact Type is Household, but then when we add another “And” for the first gift date, we see that first gift date and first passthrough gift date are separate fields, meaning we need to add an “Or” to our query, but only for this parameter. That’s where the copy button comes in handy. Click on copy to copy your entire query group, and then change the First Gift date value to First Passthrough Gift date. 

Some query parameters can also work together when combined with “And,” making your query much more robust. As a general rule, two or more query parameters from an object that does NOT match your query type will work together. For example, Address fields in a Contact query will work together, so creating a query that says “Primary Address is True and State Is Texas” will return ONLY Contacts who have Texas as the state in their Primary address.

Once you’ve mastered query operators and learned the ins and outs of ands and ors, you’ll be ready to build all the queries you’ll ever need. Check out the other videos in our training series to learn even more about managing your queries.

Did this answer your question?