WHERE clause

Limited availability

InfluxDB Clustered is currently only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

Use the WHERE clause to filter results based on fields, tags, or timestamps.


SELECT_clause FROM_clause WHERE <conditional_expression> [(AND|OR) <conditional_expression> [...]]

Note: Unlike InfluxQL, SQL supports OR in the WHERE clause to specify multiple conditions, including time ranges.


Note that single quotes are required for string literals in the WHERE clause.

Filter data based on field values

FROM "h2o_feet" 
WHERE "water_level" >= 9.78

View example results

Filter data based on specific tag and field values

FROM "h2o_feet" 
WHERE "location" = 'santa_monica' and "level description" = 'below 3 feet' 

View example results

Filter data within a specific time period

FROM h2o_feet 
WHERE "location" = 'santa_monica'
AND "time" >= '2019-08-19T12:00:00Z'::timestamp AND "time" <= '2019-08-19T13:00:00Z'::timestamp 

View example results

Filter data using the OR operator

FROM "h2o_feet"
WHERE "level description" = 'less than 3 feet' OR "water_level" < 2.5

View example results

Was this page helpful?

Thank you for your feedback!

The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following: