Case这东西在存储过程我用的很少,但是他又是一个不可以多的好东西
Code
SELECT
'Price Category' =
CASE
WHEN
price IS NULL
THEN
'Not yet priced'
WHEN
price < 10
THEN
'Very Reasonable Title'
WHEN
price >= 10 and price < 20
THEN
'Coffee Table Title'
ELSE
'Expensive book!'
END,
FROM
titles
ORDER
BY price