Created
April 8, 2014 07:13
-
-
Save sqlparser/10098931 to your computer and use it in GitHub Desktop.
case expression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT productnumber, | |
name, | |
'Price Range' = CASE | |
WHEN listprice = 0 THEN 'Mfg item - not for resale' | |
WHEN listprice < 50 THEN 'Under $50' | |
WHEN listprice >= 50 | |
AND listprice < 250 THEN 'Under $250' | |
WHEN listprice >= 250 | |
AND listprice < 1000 THEN 'Under $1000' | |
ELSE 'Over $1000' | |
END | |
FROM production.product | |
ORDER BY productnumber; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment