You can select all the rows that have a value between two limits. The limits are inclusive. You can abbreviate BETWEEN as BT. Comparisons using BETWEEN do not work unless the smaller value comes before the larger value. In the following example, notice that the smaller value, 20000, appears immediately after BT.
When you run this query:
Q.STAFF | ID | NAME | SALARY | --------+----+------+--------------------| P. | | | BT 20000 AND 21000 | |
QMF produces this report:
ID NAME SALARY ----- --------- --------- 50 HANES 20659.80 210 LU 20010.00 310 GRAHAM 21000.00
You can select all rows that have YEARS equal to 8, 9, or 10.
When you run this query:
Q.STAFF | ID | NAME | YEARS | SALARY | --------+----+-------+------------------+------------| P. | | | BETWEEN 8 AND 10 | | |
QMF produces this report:
ID NAME YEARS SALARY ----- --------- ------ ---------- 20 PERNAL 8 18171.25 50 HANES 10 20659.80 190 SNEIDER 8 14252.75 210 LU 10 20010.00 270 LEA 9 18555.50 280 WILSON 9 18674.50 290 QUILL 10 19818.00
Use BETWEEN either in an example table or in a CONDITIONS box. You can enter _Y in the YEARS column and _Y BETWEEN 8 AND 10 in a CONDITIONS box to produce the same report as above.
Q.STAFF | ID | NAME | YEARS | SALARY | --------+----+-------+--------------+------------| P. | | | _Y | | | CONDITIONS | |--------------------------| | _Y BETWEEN 8 AND 10 | |