本帖最后由 student_2008 于 2011-05-11 19:06:58 编辑

解决方案 »

  1.   

    SELECT 日期,
           decode(grouping_id(开户行), 1, '总计', 开户行) 开户行,
           账户名,
           账号,
           SUM(金额),
           摘要
      FROM 表1
     GROUP BY ROLLUP(开户行, (日期, 账户名, 账号, 摘要));
      

  2.   

    select date,kh,zhuser,account,sum(price) 
    from tb
    group by date,kh,zhuuser,account