Kbase 18191: Results: Combining "AND" and "OR" in Selection Criteria.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/17/1998 |
|
Results: Combining "AND" and "OR" in Selection Criteria.
Results: Combining "AND" and "OR" in Selection Criteria.
When combining "AND" and "OR" in the selection criteria
for a table in Results, you might not get "expected"
information.
For example: If you want all the records from the Order
table with Sales-Rep "bbb" and whose dates are less
than, equal to, or greater than 01/01/93,
SPORTS81.Order.Order-Date >= 01/01/1993
OR SPORTS81.Order.Order-Date < 01/01/93
AND SPORTS81.Order.Sales-Rep = "bbb"
Will *NOT* fetch you just the records with "bbb" as
the Sales-Rep.
This is because, "AND" has precedence over "OR" and
gets evaluated first.
To get the correct information, you can do either of
two things:
1. Put parenthesis around the statements containing
the "OR",
Example: (SPORTS81.Order.Order-Date >= 01/01/1993
OR SPORTS81.Order.Order-Date < 01/01/93)
AND SPORTS81.Order.Sales-Rep = "bbb"
2. Use the "AND" statement before the "OR" statement.
Example: SPORTS81.Order.Sales-Rep = "bbb"
AND SPORTS81.Order.Order-Date >= 01/01/1993
OR SPORTS81.Order.Order-Date < 01/01/93