0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

InfluxQL: 過去 24 時間からレコードを選択しますか?

Posted at

これはクエリです:

SELECT mean("value") FROM "autogen"."°C" WHERE ("entity_id" = 'shelly_1l_our_room_device_temperature') AND $timeFilter GROUP BY time($__interval) fill(null)

同じデータを使用して2番目のクエリを追加しようとしていますが、24時間遅れています

多くのことを試しましたが、うまくいかないようです:

SELECT mean("value") FROM "autogen"."°C" WHERE ("entity_id" = 'shelly_1l_our_room_device_temperature') AND DATE_SUB(NOW(), INTERVAL 24 HOUR) GROUP BY time(20s) fill(null)

SELECT mean("value") FROM "autogen"."°C" WHERE ("entity_id" = 'shelly_1l_our_room_device_temperature') AND time >= now() - 48h and time <= now() - 24h GROUP BY time($__interval) fill(null)

そんなの構文は私には良さそうですが、データ自体に問題がある可能性があります。

確認のため、以下をお試しいただけますでしょうか。

過去 24 時間のデータがあるかどうかを確認する

SELECT "value" FROM "autogen"."°C" WHERE ("entity_id" = 'shelly_1l_our_room_device_temperature') AND time >= now() - 24h

集計を適用する

SELECT mean("value") FROM "autogen"."°C" WHERE ("entity_id" = 'shelly_1l_our_room_device_temperature') AND time >= now() - 24h GROUP BY time(20s) FILL(null)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?