Combining multiple condition in single case statement in Sql Server

前端 未结 2 1660
伪装坚强ぢ
伪装坚强ぢ 2021-01-11 12:07

According to the following description I have to frame a CASE...END statement in SQL server , help me to frame a complex CASE...END statement to fu

2条回答
  •  有刺的猬
    2021-01-11 12:48

    select ROUND(CASE 
    
    WHEN  CONVERT( float, REPLACE( isnull( value1,''),',',''))='' AND CONVERT( float, REPLACE( isnull( value2,''),',',''))='' then  CONVERT( float, REPLACE( isnull( value3,''),',',''))
    
    WHEN  CONVERT( float, REPLACE( isnull( value1,''),',',''))='' AND CONVERT( float, REPLACE( isnull( value2,''),',',''))!='' then  CONVERT( float, REPLACE( isnull( value3,''),',',''))
    
    WHEN  CONVERT( float, REPLACE( isnull( value1,''),',',''))!='' AND CONVERT( float, REPLACE( isnull( value2,''),',',''))='' then  CONVERT( float, REPLACE( isnull( value3,''),',',''))
    
    else CONVERT( float, REPLACE(isnull( value1,''),',','')) end,0)  from Tablename where    ID="123" 
    

提交回复
热议问题