You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In most SQL dialects that I have used, the fields in GROUP BY's must be a subset of those in SELECT'. For example SELECT foo, sum(bar) GROUP BY foo is legal, but SELECT sum(bar), GROUP BY foo is not legal.
In InfluxQL, I am understanding that it's the opposite. The sets of fields in SELECT and GROUP BY must be non-overlapping, otherwise I get err: mixing aggregate and non-aggregate queries is not supported.
I wonder if
a) The documentation could be explicit about this difference between InfluxQL and most other SQLs.
Updated docs to be more explicit about the following:
cannot GROUP BY fields
SELECT cannot include an aggregate function with any of the following:
non-aggregate/selector function
tag key
field key
In your example, including both an aggregate and non-aggregate value in the SELECT clause was the issue—you can overlap SELECT tags and GROUP BY tags.
I agree, the error message could be more explicit: SELECT clause cannot include an aggregate function and a non-aggregate function, field key, or tag key.
PS. Error messages are updated in another repo—I’ll create an associated issue and link here so you know where it lands.
In most SQL dialects that I have used, the fields in
GROUP BY
's must be a subset of those inSELECT
'. For exampleSELECT foo, sum(bar) GROUP BY foo
is legal, butSELECT sum(bar), GROUP BY foo
is not legal.In InfluxQL, I am understanding that it's the opposite. The sets of fields in
SELECT
andGROUP BY
must be non-overlapping, otherwise I geterr: mixing aggregate and non-aggregate queries is not supported
.I wonder if
a) The documentation could be explicit about this difference between InfluxQL and most other SQLs.
b) The error message could be improved?
URL for relevant page?
https://docs.influxdata.com/influxdb/v1.7/query_language/data_exploration/#the-group-by-clause
What products and version are you using?
InfluxDB 1.7
Where did you look before opening the issue?
I eventually found it in the docs, but it took me a while to figure it out...
The text was updated successfully, but these errors were encountered: