求工资大于等于8000的增加15%小于8000加20%   语句贴上

解决方案 »

  1.   

    update tab set 工资=(case when 工资>=8000 then 工资*1.15 else 工资*1.2 end)
      

  2.   


    decode(x>=8000,x+15%,x+20%)
      

  3.   

    求工资大于等于8000的增加15%小于8000加20% 语句贴上
    case when sal > 8000 then sal*(1+0.2)
    else sal * (1+0.15)
      

  4.   

    update date emp set sal=(case when sal>=8000 then sal*1.2 else sal*1.15 end);-- decode 函数只适用于已知的固定值,不适用于区间值,区间值只能用 case when语句
      

  5.   

    不用decode去实现我也会  来点实际的
      

  6.   


    -- 实际啥啊? 我4楼不已经告诉你了吗?你这样的需求只能用 case when,不能用decode()函数!
      

  7.   

    好像不行哦。如果数据库是9i的话,那就用case when吧
      

  8.   

    decode 只能进行等价判断,而不能进行 大小于等的判断,你这个只能用 CASE WHEN 实现 
      

  9.   

    update tab set 工资 = decode(sign(工资 -8000),-1,工资*1.2,0,工资*1.15,1,工资*1.15);
    试试吧
      

  10.   

    update tab set 工资 = decode(sign(工资-8000),-1,工资*1.2,工资*1.15);
      

  11.   

    update tb set sal=decode(sign(sal-8000),1,sal*1.15,0,sal*1.15,-1,sal*1.2)update tb set sal=(case when sal>=8000 then sal*1.15 when sal<8000 then sal*1.2 end)--要是我们公司有这样的加薪的话 我就更开心 唉努力