InfluxDB-在基于标签的where子句中包含多个值 [英] InfluxDB - Including multiple values in where clause based on tags

查看:899
本文介绍了InfluxDB-在基于标签的where子句中包含多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据标签值查询数据.是否可以在where子句中包含多个查询.我在SQL中找不到类似于IN运算符的运算符.

I'm trying to query data based on tag values. Is it possible to include multiple queries in the where clause . I could not find an operator similar to the IN operator in SQL.

select * from students where rollNumber='1' limit 10

学生是度量,而rollNumber是标签.我想在查询中包含rollNumber的多个值.

students is the measurement and rollNumber is a tag. I want include multiple values of rollNumber in the query.

有解决问题的建议吗?

推荐答案

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...

这篇关于InfluxDB-在基于标签的where子句中包含多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆