influxdbinfluxql

Subtract two queries results


Cannot find per the docs, and there is an old issue related to this.

It is possible to subtract the results of 2 queries?

Something like this in SQL:

(SELECT COUNT(*) FROM test - (SELECT COUNT(*) FROM test WHERE …)

Solution

  • As far as I know, currently it is not possible (at least not with InfluxQL).

    It should, however, be possible with their new query language called Flux (as of InfluxDB1.7)

    https://docs.influxdata.com/flux/v0.24/introduction/getting-started/