InfluxDB 2.0 unexpected token trying to group by time

So I have data in a bucket in InfluxDB 2.0 I’m in the “Data Explorer” and I’m trying to write a query to see the data that I have inserted.

I’m trying a simple query, but I can’t seem to make it work, even if I took an example from the documentation.

SELECT COUNT(driverNo) FROM "csvDataTest" WHERE time >= "2021-01-18T00:06:00Z" AND time < "2021-08-18T00:18:00Z" GROUP BY time(12m,6m)

It keeps saying

unexpected token for property key: DURATION (12m)

All examples I’ve seen in the documentation group by time this way.

What am I doing wrong? Can anyone help me?

Hello @Danielle_Paquette-Ha,
Can you please share your input data as well as the documentation you’re referring to?
Does a simple Group by time(12m) work?

Oh, I think I have figured it out. I think I was looking at the documentation from version 1.7 instead of version 2.0

It works when I try the syntax from the 2.0 documentation.

The query looks something like this instead (I removed the count, still working on query syntax but the group by clause works now).

from(bucket: "csvDataTest")
|> range(start: 1900-01-10T00:00:00Z, stop: 2021-04-23T00:00:00Z)
|> filter(fn: (r) => r._measurement == "channels")
|> filter(fn: (r) => r.driverNo == "12345")
|> group(columns: ["_time"])
1 Like