时间:2021-07-01 10:21:17 帮助过:6人阅读
SELECT MOVING_AVERAGE(MIN(water_level),2) FROM h2o_feet WHERE location = ‘santa_monica‘ AND time >= ‘2015-08-18T00:00:00Z‘ and time <= ‘2015-08-18T00:36:00Z‘ GROUP BY time(12m)
结果:
name: h2o_feet
--------------
time moving_average
2015-08-18T00:12:00Z 2.0460000000000003
2015-08-18T00:24:00Z 2.0345000000000004
2015-08-18T00:36:00Z 2.0540000000000003
解释:
这些结果,InfluxDB首先选择MIN()
water_level
每12分钟间隔:
name: h2o_feet
--------------
time min
2015-08-18T00:00:00Z 2.064
2015-08-18T00:12:00Z 2.028
2015-08-18T00:24:00Z 2.041
2015-08-18T00:36:00Z 2.067
然后使用这些值来计算移动平均在每2字段值,移动平均线列中的第一个结果的平均值2.064和2.028,第二个结果是2.028和2.041的平均水平。
influxDB 变换类函数
标签:mon 例子 group 计算 span lin float uri 4类