Un case dans une requête SQL
CASE
WHEN when-condition THEN result-expression
WHEN when-condition THEN result-expression
ELSE result-expression
END
Exemple :
select Name, case when Continent = 'North America' then 'Continental U.S.' when Continent = 'Oceania' then 'Pacific Islands' else 'None' end as Region from states
Autre syntaxe
select Name, case Continent when 'North America' then 'Continental U.S.' when 'Oceania' then 'Pacific Islands' else 'None' end as Region from states