sql 利用 case when then 多条件判断

1.

select xuehao,name1,dengji=
case
when zongfenshu <50 then '不及格'
when zongfenshu >=50 and zongfenshu <=60 then '合格'
else '优秀'
end from aaa where zhuanyeming='计算机'
2.
update aaa
set zongfenshu =
case
when dengji ='及格' then zongfenshu+5
when dengji='优秀' then zongfenshu+20
else zongfenshu*2
end 

 

posted on 2013-02-27 11:06  淘果果  阅读(214)  评论(0编辑  收藏  举报

导航