语法:
case <expression> when <expression>|<search_condition> then <result>
else <result> end
示例:
select case qtr
when 'Q1_98' then '1st Quarter'
when 'Q2_98' then '2nd Quarter'
when 'Q3_98' then '3rd Quarter'
when 'Q4_98' then '4th Quarter'
end as Period,
sum (dollars) as results
from sales natural join period
case <expression> when <expression>|<search_condition> then <result>
else <result> end
示例:
select case qtr
when 'Q1_98' then '1st Quarter'
when 'Q2_98' then '2nd Quarter'
when 'Q3_98' then '3rd Quarter'
when 'Q4_98' then '4th Quarter'
end as Period,
sum (dollars) as results
from sales natural join period
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货