1

I’m trying to subtract the mean from a column in InfluxQL 1.7.

> select col - mean(col) from sensor 
-- Err: mixing aggregate and non-aggregate queries is not supported
 
> select col - 2 from sensor 
-- works fine

> select col - meanC from (select col from sensor),(select mean(col) as meanC from sensor)
time              value_meanV
----              -----------
2019-03-02T14:19:34.000000001Z 
2019-03-02T14:19:40Z      
2019-03-02T14:19:50Z      
2019-03-02T14:20:00Z      
2019-03-02T14:20:10Z      
2019-03-02T14:20:20Z      
2019-03-02T14:20:30Z

The last query is giving wrong results. I think it could be done to the join type.

How could such an operation be made?

AbdelKh
  • 499
  • 7
  • 19

0 Answers0