更新时间:2023-10-23 15:43:04
InfluxDB没有IN运算符,但是它在WHERE子句中支持用于字段和标签的Go-lang正则表达式.正则表达式用/
括起来,并且需要在比较运算符之后添加~
:
InfluxDB does not have IN operator, however it supports Go-lang regular expressions in WHERE clause for fields and tags. Regular expressions are enclosed with /
and require adding ~
after comparison operator:
select * from students where rollNumber =~ /1|2|3/ limit 10
这将返回10个具有rollNumber
1或2或3的学生.
This will return 10 students with rollNumber
1 or 2 or 3.
注意::在过滤字段的情况下,如果字段类型不是字符串,则正则表达式将不起作用...
Note: In case of filtering fields, if the type of fields is not string, regex will not work...