首页 > 数据库技术 > 详细

Oracle Partition Outer Join 稠化报表

时间:2015-10-09 13:39:51      阅读:248      评论:0      收藏:0      [点我收藏+]

partition outer join实现将稀疏数据转为稠密数据,举例:

with t as
 (select deptno, job, sum(sal) sum_sal from emp group by deptno, job),
tt as
 (select distinct job from t)
select b.deptno, a.job, sum_sal
  from tt a
  left join t b partition by (b.deptno)
    on a.job = b.job

数据显示结果:

 

技术分享

按照所有deptno和job显示出sal总值,没有对应值显示为空。

具体资料参考:

http://blog.sina.com.cn/s/blog_4cef5c7b01016lm5.html

Oracle Partition Outer Join 稠化报表

原文:http://www.cnblogs.com/mellowsmile/p/4863561.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!