【发布时间】:2018-08-17 14:26:14
【问题描述】:
我正在使用 InfluxDB 1.4,这是我的任务
1) find the closet value for each IDs.
2) Do 1) for every hour
例如,
select id, value, time from myTable where time = '2018-08-14T00:00:00Z' group by id;
select id, value, time from myTable where time = '2018-08-14T01:00:00Z' group by id;
....
select id, value, time from myTable where time = '2018-08-14T23:00:00Z' group by id;
然后,一些 id 在每个点钟都有价值,而另一些则没有。在这种情况下,我想获得最接近给定时间“2018-08-14T14:00:00Z”的行,例如“2018-08-14T14:00:01Z”或“2018-08-14T13:59”: 59Z'
我不想每小时查询 24 次。我可以使用 group by time、id 或其他东西来完成这项任务吗?
【问题讨论】:
-
您介意解释您的问题吗?
closest值是什么意思?最接近? -
我编辑了我的问题。我想要的是获得最接近给定时间的行。之前或之后。比如“2018-08-14T14:00:01Z”或“2018-08-14T13:59:59Z”