The CASE expression is used to implement if-then logic.
- CASE input_expression
WHEN compare1 THEN result1
[WHEN compare2 THEN result2]...
WHEN condition1 THEN result1
[WHEN condition2 THEN result2]...
The simple CASE expression returns the first result whose
compareX value is equal to the
The searched CASE expression returns the first result whose
conditionX is true.
CASE in a clause ORDER BY
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0