SQL conditional functions
The InfluxDB SQL implementation supports the following conditional functions for conditionally handling null values:
Returns the first of its arguments that is not null. Returns null if all arguments are null. This function is often used to substitute a default value for null values.
coalesce(expression1[, ..., expression_n])
- expression1, expression_n: Column or literal value to use if previous expressions are null. Pass as many expression arguments as necessary.
coalesce query example
Returns null if expression1 equals expression2; otherwise it returns expression1.
This can be used to perform the inverse operation of
- expression1: Column or literal value to compare and return if equal to expression2.
- expression2: Column or literal value to compare to expression1.
nullif query example
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.