select
FullDepartmentName,
YearBudget ,
SupplementaryBudget ,
TotalSum ,
BudgetDate,
case jidu
when 'JANUARYBUDGET' then 1
when 'FEBRUARYBUDGET' then 2
when 'MARCHBUDGET' then 3
when 'APRILBUDGET' then 4
when 'MAYBUDGET' then 5
when 'JUNEBUDGET' then 6
when 'JULYBUDGET' then 7
when 'AUGUSTBUDGET' then 8
when 'SEPTEMBERBUDGET' then 9
when 'OTOBERBUDGET' then 10
when 'NOVEMBERBUDGET' then 11
when 'DECEMBERBUDGET' then 12
else 00
end case,
jidu,
xiaoshou
from excelmodel
unpivot (xiaoshou for jidu in (JanuaryBudget,februaryBudget,marchBudget,aprilBudget,mayBudget,juneBudget,julyBudget,augustBudget
,septemberBudget,otoberBudget,novemberBudget,decemberBudget) )
where YearBudget=9000.00
and FullDepartmentName='运营部'
格式:
case 变量
when '值1' then doSomeThing
when '值2' then doSomeThing
....
else doSomeThing
end 【case】,