日期:2014-05-17 浏览次数:20944 次
select col1,file1,file2,file3,file1+file2+file3 合计
from
    (select nvl(col1,'合计') col1,
           sum(decode(col2,'file1',col3,0)) file1,
           sum(decode(col2,'file2',col3,0)) file2,
           sum(decode(col2,'file3',col3,0)) file3
    from a
    group by rollup(col1)
    order by col1)
    col1     file1   file2  file3   合计
----------------------------------------------
1    dev1    5    6    0    11
2    dev2    0    3    4    7
3    合计    5    9    4    18