oracle 行转列

select e.job as 工作,
sum(case e.deptno
when 10 then
sal
end) as 部门10的工资,
sum(case e.deptno
when 20 then
sal
end) as 部门20的工资,
sum(case e.deptno
when 30 then
sal
end) as 部门30的工资
from emp e
group by job
order by 1;

 

 

posted @ 2018-05-10 14:04  wupf  阅读(356)  评论(0编辑  收藏  举报