Syntax:
CASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN
result ...] [ELSE result] END

CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...]
[ELSE result] END

The first CASE syntax returns the result for the first
value=compare_value comparison that is true. The second syntax returns
the result for the first condition that is true. If no comparison or
condition is true, the result after ELSE is returned, or NULL if there
is no ELSE part.

*Note*:

The syntax of the CASE expression described here differs slightly from
that of the SQL CASE statement described in [HELP CASE statement], for
use inside stored programs. The CASE statement cannot have an ELSE NULL
clause, and it is terminated with END CASE instead of END.

The return type of a CASE expression result is the aggregated type of
all result values.

URL: http://dev.mysql.com/doc/refman/5.5/en/control-flow-functions.html

