1.行转列:有两种写法,一种是case when end写法,另一种写法是pivot(oracle 11g新增) select job, then sal end) as sal10, then sal end) as sal20, then sal end) as sal30, sum(sal) as allsal from emp group by job ; select * from (select job,sal,deptno from emp) pivot( , as d30)) ;