答案 0 :(得分:0)
您可以使用如下查询:
SELECT job
, sum( if( deptno = 10 ,sal,0) ) AS DEPT10
, sum( if( deptno = 20 ,sal,0) ) AS DEPT20
, sum( if( deptno = 30 ,sal,0) ) AS DEPT30
, sum( if( deptno = 40 ,sal,0) ) AS DEPT40
FROM YourTable
Group BY job;