Quick Ref.
Compatibility
CASE WHEN b1 THEN v1 END
Engine OK Alternative
ingres yes
mysql yes
oracle yes
postgres yes
sqlserver yes

CASE

CASE allows you to return different values under different conditions.

If there no conditions match (and there is not ELSE) then NULL is returned.

  CASE WHEN condition1 THEN value1 
       WHEN condition2 THEN value2  
       ELSE def_value 
  END
  

Results
See also: