You are here

Add new comment

CASE - command

Syntax

Description

    With CASE you can proceed data in relation to other data.

    Example:

SELECT knum, kname,
CASE
  WHEN stadt <> 'Berlin'
  THEN LEFT('Das ist ein Nichtberliner, der sehr schlecht ist...',40)
  ELSE stadt
END berlin_ja_nein
FROM tkunden
WHERE rating>1;

Here are selectted all customers, where rating is bigger than 1, and only between curtomers living in Berlin and the others is made a difference.