例如,来自两个不同位置的温度数据存储在一个测量中,如
time temperature location
---- ---- ----
1 15 A
2 20 B
3 17 A
4 18 B
如何通过查询计算A和B温度之间的差异? 即期待类似“SELECT a.temperature - b.temperature FROM measurement WHERE location ='A'as WHERE location ='B'as b”
由于
答案 0 :(得分:0)
Influx查询语言不支持跨度量的函数。
答案 1 :(得分:0)
例如,您可以使用subqueries
SELECT last("temp_a") - last("temp_b") FROM (
SELECT "gauge" AS "temp_a" FROM "measurement" WHERE ("location"='A') AND $timeFilter
),(
SELECT "gauge" AS "temp_b" FROM "measurement" WHERE ("location"='B') AND $timeFilter
) GROUP BY time($__interval) fill(null)