只要判断就可以了 
select case when 费用1 is null then 0 end 费用1,
       case when 费用2 is null then 0 end 费用2,
       case when 费用3 is null then 0 end 费用4,
from 表名

解决方案 »

  1.   

    只要判断就可以了 
    select case when 费用1 is null then 0 end 费用1,
           case when 费用2 is null then 0 end 费用2,
           case when 费用3 is null then 0 end 费用3
    from 表名
      

  2.   

    SELECT SUM(NVL(费用1,0)),SUM(NVL(费用2,0)),SUM(NVL(费用3,0))
    FROM TBL
    GROUP BY 人员
      

  3.   

    select person,
           nvl(sum(decode(fee,'费用1',total)),0)费用1,
           nvl(sum(decode(fee,'费用2',total)),0)费用2,
           nvl(sum(decode(fee,'费用3',total)),0)费用3
    from table
    group by person;