InfluxDB - Including multiple values in where clause based on tags

大城市里の小女人 提交于 2020-07-30 05:40:12

问题


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

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

Any suggestions to solve the problem?


回答1:


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

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



来源:https://stackoverflow.com/questions/50983872/influxdb-including-multiple-values-in-where-clause-based-on-tags

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!