当前位置:Gxlcms > 数据库问题 > Oracle Partition Outer Join 稠化报表

Oracle Partition Outer Join 稠化报表

时间:2021-07-01 10:21:17 帮助过:1人阅读

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 稠化报表

标签:

人气教程排行