上卷

    1. select zhid,doccode,sum(jyje) from fixf_svr_xzhjymx group by ROLLUP ( zhid,doccode );

    所有分组总和

    1. select zhid,doccode,sum(jyje) from fixf_svr_xzhjymx group by CUBE ( zhid,doccode );

    grouping统计分组标记
    0表示参与汇总计算,1表示未参与汇总计算

    1. select zhid,doccode,sum(jyje),
    2. grouping(zhid) ,
    3. grouping(doccode)
    4. from fixf_svr_xzhjymx group by ROLLUP ( zhid,doccode );

    GROUPING sets
    多次分组统计

    1. select zhid,sum(jyje),
    2. grouping(zhid) ,
    3. grouping(doccode)
    4. from fixf_svr_xzhjymx group by GROUPING sets (( zhid,doccode),jynx);