摘要:
下文讲述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)
)
go

insert into [maomao365.com]
(xingbie)values('1'),
('0'),('1')
,('1'),('2')
go

select 
keyId,
case 
when xingBie ='1' or xingBie ='2' 
then N'性别'
when xingBie ='0' 
then N'未填写!'
else ''
end as xingBie 
from [maomao365.com]

 


go
truncate table [maomao365.com]
drop table [maomao365.com]

 

相关文章:

  • 2021-09-26
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案