写一下语句,加深记忆
select case column_name1
when value1 then result1
[when value2 then result2.....][else result]
end [as column_new_name]
[,case
when expr1 then result1
[when expr2 then result2...]
[else result]
end [as column_new_name]
[,case...]
]
from tb_name;