Product Solutions Support
Try MemSQL

COALESCE

Given a list of values, returns the first non-NULL value.

Syntax

COALESCE ( val, [val, [val ...]])

Arguments

Return Type

Returns any object type, according to the type of the first non-NULL value in the list. Returns NULL if all values are NULL.

Examples

memsql> select coalesce(NULL, NULL, 1, 2, 3);
+-------------------------------+
| coalesce(NULL, NULL, 1, 2, 3) |
+-------------------------------+
|                             1 |
+-------------------------------+
Was this article useful?