2

I am trying to query data every nth element in InfluxDB. I am executing the command below to do so, but I am getting no results. I am using sample data that I created for the sake of the example.

The command I am running in Influx's CLI:

SELECT value FROM generators GROUP BY time(5s)

The result:

GROUP BY requires at least one aggregate function

I am new to InfluxDB, and I am not sure what I am doing wrong. I have read up on making a continuous query, but when I do make one, I am unable to query data as it returns no results. Thank you all to those in advance who reply.

Kyle DeGennaro
  • 188
  • 3
  • 12

1 Answers1

3

You can use functions like FIRST() or LAST() depending on your requirement.

SELECT FIRST(value) FROM generators GROUP BY time(5s)

https://docs.influxdata.com/influxdb/v1.7/query_language/functions/

Speeeddy
  • 154
  • 8