'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 1:[1]

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/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nikolay Manolov