Partager via


BETWEEN( ) Function

Determines whether the value of an expression lies between the values of two other expressions of the same data type.

BETWEEN(eTestValue, eLowValue, eHighValue)

Return Values

Logical or null value

Parameters

  • eTestValue
    Specifies the expression whose value BETWEEN( ) tests. If the value of eTestValue is greater than or equal to the value of eLowerValue and less than or equal to the value of eHighValue, BETWEEN( ) returns True (.T.). Otherwise, BETWEEN( ) returns False (.F.). BETWEEN( ) returns the null value if either eLowValue or eHighValue are the null value.
  • eLowValue
    Specifies the lower value in the range BETWEEN( ) evaluates.
  • eHighValue
    Specifies the upper value in the range BETWEEN( ) evaluates.

Remarks

BETWEEN( ) returns a value of True (.T.) if the value of a character, date, datetime, numeric, float, integer, double, or currency expression lies between the values of two other expressions of the same data type. If the value of the expression doesn't lie between the values of two other expressions, BETWEEN( ) returns False (.F.). BETWEEN( ) returns the null value if either eLowValue or eHighValue is the null value.

Example

The following example scans the orders table for all records in the order_amt field with values between 950 and 1000 inclusive and displays the cust_id field and the order_amt field.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE orders  && Open order table

CLEAR
SCAN FOR BETWEEN(order_amt,950,1000)
   ? cust_id, order_amt
ENDSCAN

See Also

MAX( ) | MIN( ) | SET TRBETWEEN Command