• mssql sqlserver 如何编写case when 多条件呢?


    摘要:
    下文讲述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]
  • 相关阅读:
    ZOJ 3556
    ZOJ 2836
    HDU 2841
    HDU 4135
    POJ 3695
    POJ 2773
    HDU 4407
    HDU 1796
    ZOJ 3688
    ZOJ 3687
  • 原文地址:https://www.cnblogs.com/lairui1232000/p/11872252.html
Copyright © 2020-2023  润新知