Use AND if you are trying to fulfill two criteria. Parenthesis are not needed for only two criteria. However, if you have more than two criteria, place your criteria within parenthesis.
Use OR if you are trying to fulfill one or the other criterion. For example, you want A OR B but not both.
You want to find all contacts that are either in GA or the UK and do not belong to the VIP contact list.
When (country = GA
OR country = UK)
AND contact is not in Contact List VIP.)
In this case, if there are no parenthesis, the query looks for contacts who have a country of GA or UK regardless of if they are in the contact list or not because it's looking for contacts who meet one criteria or the other. However, when you use parentheses, they define which criteria to perform first, then second, third and so on based on the number of criteria.
Use parentheses to group the OR statements in queries
If you have an AND statement and a number of logically related OR statements (where the OR statements are on the same field), you should always use parentheses to group the OR statements together.
[SEGMENT] equals 2 OR [SEGMENT] equals 3 OR [SEGMENT] equals 4 AND [NYC] equals Y
([SEGMENT] equals 2 OR [SEGMENT] equals 3 OR [SEGMENT] equals 4) AND [NYC] equals Y
The placement and use of the parentheses do matter in terms of what data is pulled.
Two emails were sent to contacts. One email had a buy one, get one free (BOGO) offer, the other email had a free $25 gift card upon completion of a survey. The recipients meeting the criteria for the BOGO offer were to get the BOGO email and the recipients for the gift card offer were to get the gift card email.
The below example is the CORRECT query to use so that each recipient received their specific offer. Note the placement of the parentheses:
( [Store No] is in list (10001,10002,10031,10118,10171,10199,10451,10582,10587,10600, 10616,10619,10741,10820,10830,10902,10935,10951,10971,11125, 13360,13408,13408,13493,13511,13517,13599,13698,13712,17674))
The below example below is INCORRECT. It would result in the BOGO emails being sent to those with gift card criteria and vice versa. Notice the absence of the opening and closing parentheses:
[[Store No] is in list (10001,10002,10031,10118,10171,10199,10451,10582,10587,10600, 10616,10619,10741,10820,10830,10902,10935,10951,10971,11125, 13360,13408,13408,13493,13511,13517,13599,13698,13712,17674)