1SELECT CASE lower(col1)
2 WHEN 'agree' THEN 'Ok'
3 WHEN 'disagree' THEN 'Ko'
4 ELSE
5 CASE
6 WHEN col2 = 1 THEN 'Ko'
7 ELSE 'Maybe'
8 END
9END AS my_result
10FROM table_name;
1SELECT
2 CASE
3 WHEN
4 column IS NULL OR another_column = 1
5 THEN
6 'yes'
7 ELSE
8 'no'
9 END AS 'MyData'
10FROM
11 table_name;
1SELECT CASE col1
2 WHEN 'agree' THEN 'Ok'
3 WHEN 'disagree' THEN 'Ko'
4 ELSE
5 CASE
6 WHEN col2 >= 1 THEN 'Ko'
7 ELSE 'Maybe'
8 END
9END AS my_result
10FROM table_name;
1SELECT
2t2.company_name,
3t2.expose_new,
4t2.expose_used,
5t1.title,
6t1.status,
7 CASE status
8 when 'New' and t2.expose_new = 1 then 1
9 when 'New' and t2.expose_new = 2 then 2
10 when 'New' and t2.expose_new = 3 then 3
11 when 'Used' and t2.expose_used = 1 then 1
12 when 'Used' and t2.expose_used = 2 then 2
13 when 'Used' and t2.expose_used = 3 then 3
14END as expose
15FROM `products` t1
16join manufacturers t2 on t2.id = t1.seller
17where t1.seller = 4238