sql_bet(X;Y;Z)

Returns a boolean value indicating if X is between Y and Z in ascending order. This function has SQL-compatible null handling.

Syntax

sql_bet(X;Y;Z)

Input

Argument Type Description
X any numeric type The name of a column of values to test within the range defined by Y and Z.
Y any numeric type The name of a column of minimum values of the range in which to check for X.
Z any numeric type The name of a column of maximum values of the range in which to check for X.

Return Value

sql_bet(X;Y;Z) returns a boolean value of 1 if X is between Y and Z, and 0 if X not between Y and Z.

The data type of the result is integer.

If X, Y, or Z is N/A (null), the result is also N/A.

Example

In this example, the values in coly and colz provide the minimum and maximum range, respectively. The values in colx are evaluated to see if they are between the Y value and the Z value.

For null comparison, a column of results using the between(X;Y;Z) function is provided for comparison. For more information, see between(X;Y;Z).

<table cols="colx,coly,colz">
  5,1,10;
  6,10,3;
  10,2,10;
  -2,2,10;
  400,100,1000.09;
  986,986,95;
  ,,;
  ,9,;
  66,,;
 ,,2;
</table>
<willbe name="sqlbet" label="SQL Null" value="sql_bet(colx;coly;colz)"/>
<willbe name="between" label="Null" value="between(colx;coly;colz)"/>
Note: The order of the maximum and minimum columns (Y and Z) doesn't matter when using the between(X;Y;Z) function.