0

I have a measurement in influxDb with two keys: operation and count. The operation key can store two different values: 'add' and 'delete'.

I want to subtract the sum(count) value when operation='delete' to sum(count) value when operation='add'.

The following query is supported in mysql but it throws and error in influxql:

select (select sum(count) from measurement where operation='add') - (select sum(count) from measurement where operation='delete');

How can this be done using a single influxql query ? I don't think influxql allows two different where clauses in this case.

bunny
  • 115
  • 1
  • 9

1 Answers1

1

InfluxQL doesn't support this kind of multiquery math. You will need to calculate it on the app level.

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59