gpt4 book ai didi

influxdb - 如何使用时间范围从 Influx 中获取总和值?

转载 作者:行者123 更新时间:2023-12-04 03:06:14 27 4
gpt4 key购买 nike

我用Influx记录了一些串口数据,并展示了这些数据的报表。

我有这样的需求:

获取2017-05-11到2017-05-17时间07:00 AM到09:00 AM的值的总和。

在 mysql 中,这很容易,因为您可以使用一个查询来获取此值:

select sum(value) from series where time(time) >= '07:00:00' and time(time) < '09:00:00' and time > '2017-05-11' and time < '2017-05-19'

但是在Influx中(我现在用的是1.0.2),看不到这样的功能,请问influx支持这样的查询吗?

最佳答案

你可以用这个-

select sum(value) as summed_value from series where time> '2017-03-10 00:00:00' and time<'2017-05-10 00:00:00';

此外,如果您还想使用小时获取数据,在这种情况下您可以使用

 select sum(value) as summed_value from series where time> now() - 2400h and time<now() - 1200h;

如果这能解决您的问题,请告诉我。

关于influxdb - 如何使用时间范围从 Influx 中获取总和值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44072637/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com