18 lines
458 B
Plaintext
18 lines
458 B
Plaintext
[[esql-case]]
|
|
=== `CASE`
|
|
|
|
Accepts pairs of conditions and values. The function returns the value that
|
|
belongs to the first condition that evaluates to `true`. If the number of
|
|
arguments is odd, the last argument is the default value which is returned when
|
|
no condition matches.
|
|
|
|
[source,esql]
|
|
----
|
|
FROM employees
|
|
| EVAL type = CASE(
|
|
languages <= 1, "monolingual",
|
|
languages <= 2, "bilingual",
|
|
"polyglot")
|
|
| KEEP first_name, last_name, type
|
|
----
|