When it is appropriate to use the parenthesis around attributes in query builder?
Parenthesis allow for grouping of criteria.
Any time you use the OR criteria, you probably want to use parenthesis.
These are two queries that would return different records.
Query 1 (See image below): USA AND Atlanta OR Athens
Contacts are returned if they are USA AND Atlanta.
Contacts are returned if they are Athens but do not have to be Country USA.
If either side of the OR are correct, the contacts are returned. Usually this is not the desired behavior as Athens Greece.
Query 2 (See image below): USA AND (Atlanta OR Athens)
Contacts are returned if they are USA AND Atlanta.
Contacts are returned if the are USA AND Athens.
USA is always required and Atlanta or Athens are needed with USA criteria. Atlanta or Athens outside of the USA would not be included in the results.
Notice the Parenthesis used in the query.
Comments
0 comments
Please sign in to leave a comment.