表中有字段a,b,均为number类型,想在select中返回一列c,
如果a=b=1,则返回的c列为1,
        否则返回的c列为a+b

解决方案 »

  1.   

    select (case  when  a=b and a=1  then  1  else  a+b  end) as c
    from
      

  2.   


    --search
    select case when a = 1 and b = 1 then 1 else a + b end from tb
    --update
    update tb
    set c = (case when a = 1 and b = 1 then 1 else a + b end )
      

  3.   

    select (case  when  a=b and a=1  then  1  else  a+b  end) as c 
    from 
     
      

  4.   

    select (case  when  a=b and a=1  then  1  else  a+b  end) as c 
    from