本帖最后由 lwm561 于 2011-07-13 17:12:35 编辑

解决方案 »

  1.   


    insert into table_test
    select sum(FBSUM),sum(HFSUM),sum(USESUM),sum(ZFSUM)
    from table_test
      

  2.   

    select HFSUM+USESUM+ZFSUM as FBSUM ,HFSUM, USESUM, ZFSUM
    from tab
      

  3.   

    自己根据实际情况修改吧SQL> with tb as (select '1' id,100 sal,200 money from dual union all
      2  select '2' id,200 sal,200 money from dual union all
      3  select '3' id,300 sal,200 money from dual union all
      4  select '4' id,400 sal,200 money from dual )
      5  select nvl(id,'合计') id,sal,money
      6  from
      7  (select  id,sum(sal) sal,sum(money) money
      8  from tb
      9  group by rollup(id)
     10  order by id nulls first) z
     11  ;ID          SAL      MONEY
    ---- ---------- ----------
    合计       1000        800
    1           100        200
    2           200        200
    3           300        200
    4           400        200
      

  4.   


    SELECT FBSUM,HFSUM,USESUM,ZFSUM FROM table_test
    UNION ALL
    SELECT SUM(FBSUM),SUM(HFSUM),SUM(USESUM),SUM(ZFSUM)
    FROM TABLE_TEST
    ORDER BY FBSUM DESC