The AND selection clause operator links two selection criteria where both must be True for the record to be selected. The synonym & can be used.
WITH condition.1 AND condition.2
The AND selection clause operator returns True if both condition.1 and condition.2 are True. Alternatively, multiple WITH clauses can be used.
The AND and OR operators are normally of equal priority and will be evaluated strictly left to right. Brackets may need to be used to enforce evaluation in an different order. Thus a query such as
LIST CLIENTS WITH REGION = 1 AND VALUE > 1000 OR REGION = 2 AND VALUE > 500
may need brackets to achieve the desired effect
LIST CLIENTS WITH (REGION = 1 AND VALUE > 1000) OR (REGION = 2 AND VALUE > 500)
Pick style multivalue database products give AND priority over OR such that the above query would not need the brackets. This behaviour can be enabled in QM by use of the QUERY.PRIORITY.AND mode of the OPTION command.
LIST STOCK WITH QTY GT 100 AND REORDER LT 300
This command lists items found on the STOCK file with a QTY field of over 100 and a REORDER field of less than 300.
The same results can be achieved with
LIST STOCK WITH QTY GT 100 WITH REORDER LT 300