MySQL tutorial: COALESCE [EN]
top of page
CerebroSQL

MySQL: 

COALESCE

Syntax:
COALESCE(value,...)

Returns the first non-NULL value in the list, or NULL if there are no
non-NULL values.

The return type of COALESCE() is the aggregated type of the argument
types.

Example

mysql> SELECT COALESCE(NULL,1);
-> 1
mysql> SELECT COALESCE(NULL,NULL,NULL);
-> NULL

bottom of page