between operator

Filters a record set for data matching the values in an inclusive range.

between can operate on any numeric, datetime, or timespan expression.

Syntax

T | where expr between (leftRange..rightRange)

If expr expression is datetime - another syntactic sugar syntax is provided:

T | where expr between (leftRangeDateTime..rightRangeTimespan)

Parameters

Name Type Required Description
T string The tabular input whose records are to be matched. For example, the table name.
expr string The expression used to filter.
leftRange string The expression of the left range (inclusive).
rightRange string The expression of the right range (inclusive).

Returns

Rows in T for which the predicate of (expr >= leftRange and expr <= rightRange) evaluates to true.

Examples

Filter numeric values

Run the Query

range x from 1 to 100 step 1
| where x between (50 .. 55)
x
50
51
52
53
54
55

Filter datetime

Run the query

StormEvents
| where StartTime between (datetime(2007-07-27) .. datetime(2007-07-30))
| count
Count
476

Run the query

StormEvents
| where StartTime between (datetime(2007-07-27) .. 3d)
| count
Count
476