not-between 运算符 (!between)not-between operator (!between)

匹配包含范围外的输入。Matches the input that is outside the inclusive range.

Table1 | where Num1 !between (1 .. 10)
Table1 | where Time !between (datetime(2017-01-01) .. datetime(2017-01-01))

!between 可以对任何数值、日期时间或时间跨度表达式执行运算。!between can operate on any numeric, datetime, or timespan expression.

语法Syntax

T | where expr !between (leftRange..rightRange)T | where expr !between (leftRange..rightRange)

如果 expr 表达式为时间跨度,则提供另一个糖衣语法:If expr expression is datetime - another syntactic sugar syntax is provided:

T | where expr !between (leftRangeDateTime..rightRangeTimespan)T | where expr !between (leftRangeDateTime..rightRangeTimespan)

参数Arguments

  • T - 待匹配记录的表格输入。T - The tabular input whose records are to be matched.
  • expr - 要筛选的表达式。expr - the expression to filter.
  • leftRange - 左侧范围(含)的表达式。leftRange - expression of the left range (inclusive).
  • rightRange - 右侧范围(含)的表达式。rightRange - expression of the right range (inclusive).

返回Returns

T 中的行,其(expr < leftRange 或 expr > rightRange)的谓词的计算结果为 trueRows in T for which the predicate of (expr < leftRange or expr > rightRange) evaluates to true.

示例Examples

使用“!between”运算符筛选数值Filtering numeric values using '!between' operator

range x from 1 to 10 step 1
| where x !between (5 .. 9)
xx
11
22
33
44
1010

使用“between”运算符筛选日期时间Filtering datetime using 'between' operator

StormEvents
| where StartTime !between (datetime(2007-07-27) .. datetime(2007-07-30))
| count 
计数Count
5859058590
StormEvents
| where StartTime !between (datetime(2007-07-27) .. 3d)
| count 
计数Count
5859058590