Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Influxdb 使用XDB按时间分组时,如何获取最大值的时间戳_Influxdb - Fatal编程技术网

Influxdb 使用XDB按时间分组时,如何获取最大值的时间戳

Influxdb 使用XDB按时间分组时,如何获取最大值的时间戳,influxdb,Influxdb,我想知道一周中每天的峰值是什么时候 如果我这样做: select time, max("temperature") from "water_temperatures" GROUP BY time(1d) time temperature ---------- ------------- 2018-01-01T00:00:00Z 95 2018-01-02T00:00:00Z 97 2018-01-03T00:00:00Z 102 2018-0

我想知道一周中每天的峰值是什么时候

如果我这样做:

select time, max("temperature") from "water_temperatures" GROUP BY time(1d)
time                 temperature
----------           -------------
2018-01-01T00:00:00Z 95
2018-01-02T00:00:00Z 97
2018-01-03T00:00:00Z 102
2018-01-04T00:00:00Z 88
2018-01-05T00:00:00Z 94
2018-01-06T00:00:00Z 81
2018-01-07T00:00:00Z 71
2018-01-08T00:00:00Z 98
2018-01-09T00:00:00Z 127
2018-01-10T00:00:00Z 126
我得到了一个测量列表,如下所示:

select time, max("temperature") from "water_temperatures" GROUP BY time(1d)
time                 temperature
----------           -------------
2018-01-01T00:00:00Z 95
2018-01-02T00:00:00Z 97
2018-01-03T00:00:00Z 102
2018-01-04T00:00:00Z 88
2018-01-05T00:00:00Z 94
2018-01-06T00:00:00Z 81
2018-01-07T00:00:00Z 71
2018-01-08T00:00:00Z 98
2018-01-09T00:00:00Z 127
2018-01-10T00:00:00Z 126
每个记录的时间戳对应于范围的开始,而不是事件发生的时间

SELECT max("temperature") FROM "water_temperatures WHERE time > now() - 30d 
它应该返回一个值,即最大温度及其时间戳

希望有帮助


dg

从XDB 1.4开始,这似乎还不受支持。这里是github上的相应问题:。

谢谢Davidgs,但我想要的是一天中的某个时间,一周中的每一天都有一个最大峰值。一个时间戳+每天的值。