COALESCE

Returns the first non-null value from a list of options.

Updated over a week ago

Description

COALESCE() scans through its arguments and returns the first non-null value encountered. It’s used to handle situations where multiple values might contain nulls, allowing you to substitute nulls with a valid value.

Syntax

COALESCE(option1, option2, )

Output

text

Variables

  1. option1, option2, ...: Multiple options to evaluate and return the first non-null value.

Example

COALESCE(`Option 1`, `Option 2`)

Option 1

Option 2

COALESCE

5

NULL

5

NULL

"Hello"

"Hello"

NULL

NULL

NULL

Did this answer your question?