Posted on 2008-11-21 09:37
Prayer 阅读(1162)
评论(0) 编辑 收藏 引用 所属分类:
数据库,SQL 、
DB2
示例一
SELECT 学号, 姓名,
等级=
CASE
WHEN 总学分 IS NULL THEN ‘尚未选课’
WHEN 总学分 < 50 THEN ‘不及格’
WHEN 总学分 >=50 and 总学分<=52 THEN ‘合格’
ELSE ‘优秀’
END FROM XS WHERE 专业名=’计算机’
示例二
update employee
set e_wage =
case
when job_level = ’1’ then e_wage*1.08
when job_level = ’2’ then e_wage*1.07
when job_level = ’3’ then e_wage*1.06
else e_wage*1.05
end
示例三
select a, (case a when 1 then '中' else '国' end) AS B from table1 软件开发网