**Warning!**This page documents an earlier version of InfluxDB, which is no longer actively developed. InfluxDB v1.5 is the most recent stable version of InfluxDB.

Mathematical operators follow the standard order of operations.
That is, *parentheses* take precedence to *division* and *multiplication*, which takes precedence to *addition* and *substraction*.
For example `5 / 2 + 3 * 2 = (5 / 2) + (3 * 2)`

and `5 + 2 * 3 - 2 = 5 + (2 * 3) - 2`

.

## Supported Operators

### Addition

You can add a constant.

`SELECT "A" + 5 FROM "add"`

`SELECT * FROM "add" WHERE "A" + 5 > 10`

You can add together other field keys.

`SELECT "A" + "B" FROM "add"`

`SELECT * FROM "add" WHERE "A" + "B" >= 10`

### Subtraction

You can subtract a constant.

`SELECT 1 - "A" FROM "sub"`

`SELECT * FROM "sub" WHERE 1 - "A" <= 3`

You can subtract one field key from another field key.

`SELECT "A" - "B" FROM "sub"`

`SELECT * FROM "sub" WHERE "A" - "B" <= 1`

### Multiplication

You can multiply by a constant.

`SELECT 10 * "A" FROM "mult"`

`SELECT * FROM "mult" WHERE "A" * 10 >= 20`

You can multiply by other field keys.

`SELECT "A" * "B" * "C" FROM "mult"`

`SELECT * FROM "mult" WHERE "A" * "B" <= 80`

Multiplication distributes across other operators

`SELECT 10 * ("A" + "B" + "C") FROM "mult"`

`SELECT 10 * ("A" - "B" - "C") FROM "mult"`

`SELECT 10 * ("A" + "B" - "C") FROM "mult"`

### Division

You can divide by a constant.

`SELECT 10 / "A" FROM "div"`

`SELECT * FROM "div" WHERE "A" / 10 <= 2`

You can divide by other field keys.

`SELECT "A" / "B" FROM "div"`

`SELECT * FROM "div" WHERE "A" / "B" >= 10`

Division distributes across other operators

`SELECT 10 / ("A" + "B" + "C") FROM "mult"`

## Operators with Functions

The use of mathematical operators inside of function calls is currently unsupported.
Note that InfluxDB only allows functions in the `SELECT`

clause.

For example

`SELECT 10 * mean("value") FROM "cpu"`

will work, however

`SELECT mean(10 * "value") FROM "cpu"`

will yield a parse error.

## Unsupported Operators

### Inequalities

Using any of `=`

,`!=`

,`<`

,`>`

,`<=`

,`>=`

,`<>`

in the `SELECT`

clause yields empty results for all types.
See GitHub issue 3525.

### Miscellaneous

Using any of `%`

, `^`

will yield a parse error.
If you would like to see support for these operators open an issue.

## Logical Operators are Unsupported

Using any of `&`

,`|`

,`!|`

,`NAND`

,`XOR`

,`NOR`

will yield parse error.

Additionally using `AND`

, `OR`

in the `SELECT`

clause of a query will not behave as mathematical operators and simply yield empty results, as they are tokens in InfluxQL.