Conditions
Use CASE expressions to define matching conditions for evaluation.
The SQL API supports the SELECT ... CASE
statement and conditions. The simple CASE
style is a list of WHEN/THEN
conditions to evaluate against.
SELECT
(CASE
WHEN cond1 THEN result1
WHEN cond2 THEN result2
ELSE result3
END)
AS FROM ...
Example
SELECT
(CASE
WHEN fieldName > 10000 THEN 'str_1'
WHEN fieldName < 1000 THEN 'str_2'
ELSE 'str_3'
END) AS alias
FROM tableName;
Updated about 1 year ago