Precedence of Control Tokens

The SMS API engine evaluates clauses from top to bottom, using the following operator precedence:

  1. ( ) Parentheses
  2. AND
  3. OR

For example, because AND has precedence over OR, the following query finds all computers with the Microsoft Excel package, and all computers that have both an 80486 processor and the Microsoft Word package:

MICROSOFT|SOFTWARE|1.0:Software Name is like '%Excel%'
OR
MICROSOFT|SOFTWARE|1.0:Software Name is like '%Word%'
AND
MICROSOFT|PROCESSOR|1.0:Processor Name is like '%486%"

If you switched the AND and OR in the previous query, the query would find all computers that have both the Microsoft Excel package and the Microsoft Word package, and all computers that have an 80486 processor:

MICROSOFT|SOFTWARE|1.0:Software Name is like '%Excel%'
AND
MICROSOFT|SOFTWARE|1.0:Software Name is like '%Word%'
OR
MICROSOFT|PROCESSOR|1.0:Processor Name is like '%486%"

By grouping the final OR subclause, the following query would find all computers that have the Microsoft Excel package and that also have the Microsoft Word package, an 80486 processor, or both:

MICROSOFT|SOFTWARE|1.0:Software Name is like '%Excel%'
AND
(
    MICROSOFT|SOFTWARE|1.0:Software Name is like '%Word%'
    OR
    MICROSOFT|PROCESSOR|1.0:Processor Name is like '%486%"
)