Case 2: WHERE searchExpr AND searchExpr
- Last Updated: August 2, 2022
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
For a compound WHERE clause, ABL builds
a logic tree and evaluates index usage on either side of the AND.
When used with the FOR EACH statement,
if both sides of the AND include equality matches
on all components of non-unique indexes, both indexes are used.
When used with the FIND statement, if both sides
of the AND are equality matches on indexed fields,
only a single index is used. Note that a word index expression with
a simple string is an equality match; a wild card string constitutes
a range match:
| Sample WHERE clause | Indexes used |
|---|---|
|
Name Sales-Rep |
|
Comments Country-Post |
If the selection criteria do not support multiple index usage, see the General rules for choosing a single index.
If ABL uses multiple indexes to select and return records, the
precise return order is not predictable. If necessary, you can use
the USE-INDEX or BY options to
guarantee record return order. In the following example, the BY
clause guarantees records are sorted by Cust-Num:
| Sample WHERE clause | Indexes used |
|---|---|
|
Sales-Rep |