上卷
select zhid,doccode,sum(jyje) from fixf_svr_xzhjymx group by ROLLUP ( zhid,doccode );
所有分组总和
select zhid,doccode,sum(jyje) from fixf_svr_xzhjymx group by CUBE ( zhid,doccode );
grouping统计分组标记
0表示参与汇总计算,1表示未参与汇总计算
select zhid,doccode,sum(jyje),
grouping(zhid) ,
grouping(doccode)
from fixf_svr_xzhjymx group by ROLLUP ( zhid,doccode );
GROUPING sets
多次分组统计
select zhid,sum(jyje),
grouping(zhid) ,
grouping(doccode)
from fixf_svr_xzhjymx group by GROUPING sets (( zhid,doccode),jynx);