Compound Query Syntax
You can add more filters, or more expressions to a single filter, to further refine a SIQL query. If you enter multiple filters, you must enter the stanzas by hierarchy. See Stanzas for more information.
Multiple Filters in a Single Query
Additional filters are separated by the operators and or or.
To indicate that the output must meet the parameters entered in both filters, join the filters with and.
stanza{attribute operator function('argument')} and stanza{attribute operator function('argument')}
Multiple Expressions in a Single Filter
When you are looking for values for multiple attributes within the same stanza, you can add those expressions within the same filter. You can join multiple expressions in the same filter with and or or.
To indicate that the output must meet the parameters entered in both expressions, join the filters with and.
stanza{attribute operator function('argument') and attribute operator function('argument)}
To indicate that the output can meet the parameters in either expression, join the filters with or.
stanza{attribute operator function('argument') or attribute operator function('argument)}
Compound Expressions in a Single Filter
Multiple expressions that can be combined and processed as a single expression in a filter are called compound expressions. Compound expressions are separated by the operators and or or, and make use of parentheses to distinguish them as expressions that must be processed as a single expression.
Operators in a query are evaluated from left to right. Parentheses are used to indicate precedence in a query, or which operators should be evaluated first.
The following example shows one filter with one expression at the beginning, followed by two compound expressions. In order for the query to return results, the database must contain values that match the first expression, and either the first or second compound expression. The database will return results if values match the first expression and compound expression 1. The database will also return results if values match the first expression and compound expression 2. The database will not return results if no values match the first expression.
The following example shows the same query with the parentheses removed.
Without parentheses to distinguish our expressions and define the order in which operators will be evaluated, results will be returned if the database contains values for all of the following:
- expression 1
- expression 2
- expression 3 or expression 4
- expression 5