SELECT
id,
CASE
WHEN date_activated > '2011-11-23 18:30:00' THEN 'after'
WHEN date_activated > '2010-01-20 00:00:00' THEN 'before'
ELSE 'not yet'
END AS date_note
FROM table1;
SELECT
CASE
WHEN
column IS NULL OR another_column = 1
THEN
'yes'
ELSE
'no'
END AS 'MyData'
FROM
table_name;
SELECT CASE col1
WHEN 'agree' THEN 'Ok'
WHEN 'disagree' THEN 'Ko'
ELSE
CASE
WHEN col2 >= 1 THEN 'Ko'
ELSE 'Maybe'
END
END AS my_result
FROM table_name;