摘要:
  下文讲述case when中多条件的编写方法,如下所示:
  实验环境:sql server 2008 R2  
case when 多条件编写方法 
      case when多条件编写语法:


case
   when 条件1 and 条件2 then '1'
when 条件1 and 条件2 then '1'
        else
end


 

case when 多条件编写举例  

create table [maomao365.com](keyId int identity,
xingBie varchar(100)
)goinsert into [maomao365.com](xingbie)values('1'),
('0'),('1')
,('1'),('2')goselect keyId,case when xingBie ='1' or xingBie ='2' then N'性别'when xingBie ='0' then N'未填写!'else ''end as xingBie 
from [maomao365.com]

 gotruncate table [maomao365.com]drop table [maomao365.com]