case
case([condition: bool, result: storable]+) -> result
Return a matching result if any of the multiple given conditions are true.
If no condition matches, return NULL. Conditions and results are evaluated in pairs in order of argument.
For a default or otherwise case, add the condition true and whatever value you want to the end of the cases.
See also if.
Domain
This is a scalar function (calculates a single output value for a single input row).
Categories
Examples
filter b=case(a=1, 'one', a=2, 'two', true, 'something else')
Filter to return rows where, if a is 1, b equals 'one', else if a is 2, b equals 'two', else b equals 'something else'. The default case is supplied at the end, using the simple condition true.
Updated 8 days ago