表数据:
select * from group_test;
分组小计、合计:
select group_id, decode(concat(job, group_id), null, '合计', group_id, group_id || ':小计', job), sum(salary) from group_test t group by rollup(t.group_id, t.job);
效果:
表数据:
select * from group_test;
分组小计、合计:
select group_id, decode(concat(job, group_id), null, '合计', group_id, group_id || ':小计', job), sum(salary) from group_test t group by rollup(t.group_id, t.job);
效果: