|
@@ -5,6 +5,7 @@
|
|
|
these functions:
|
|
|
|
|
|
* <<esql-abs>>
|
|
|
+* <<esql-case>>
|
|
|
* <<esql-concat>>
|
|
|
* <<esql-date_format>>
|
|
|
* <<esql-date_trunc>>
|
|
@@ -25,6 +26,24 @@ FROM employees
|
|
|
| EVAL abs_height = ABS(0.0 - height)
|
|
|
----
|
|
|
|
|
|
+[[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")
|
|
|
+| PROJECT first_name, last_name, type
|
|
|
+----
|
|
|
+
|
|
|
[[esql-concat]]
|
|
|
=== `CONCAT`
|
|
|
Concatenates two or more strings.
|