日期:2014-05-16  浏览次数:20469 次

选择语法
select
case
when then
else
end
from
[表名]
例子:select 姓名,工龄,
(case when (工龄>= '35') then '90%'
when (工龄>='30' and 工龄<'35') then '85%'
when (工龄>='20' and 工龄<'30') then '80%'
when (工龄>='10' and 工龄<'20') then '70%'
else  0 end) as '计算比例'
from 表

扩展
(判断是否为男或女)
select ID,
(
case
when 性别=1 then '男'
else '女'
end

)as 性别
from Table_1