收集最近用到的几个oracle函数-20170616

2018-12-10  本文已影响0人  bd6b5cde5ce9
//rollup函数:
select group_id,job,name,sum(salary) from GROUP_TEST group by rollup(group_id,job,name);
//等价于
select group_id,job,name,sum(salary) from GROUP_TEST group by group_id,job,name
union all
select group_id,job,null,sum(salary) from GROUP_TEST group by group_id,job
union all
select group_id,null,null,sum(salary) from GROUP_TEST group by group_id
union all
select null,null,null,sum(salary) from GROUP_TEST
//cube函数:
select group_id,job,name,sum(salary) from GROUP_TEST group by cube(group_id,job,name) ;
//等价于:
select group_id,job,name,sum(salary) from GROUP_TEST group by group_id,job,name
union all
select group_id,job,null,sum(salary) from GROUP_TEST group by group_id,job
union all
select group_id,null,name,sum(salary) from GROUP_TEST group by group_id,name
union all
select group_id,null,null,sum(salary) from GROUP_TEST group by group_id
union all
select null,job,name,sum(salary) from GROUP_TEST group by job,name
union all
select null,job,null,sum(salary) from GROUP_TEST group by job
union all
select null,null,name,sum(salary) from GROUP_TEST group by name
union all
select null,null,null,sum(salary) from GROUP_TEST
上一篇下一篇

猜你喜欢

热点阅读