Decode 方式 SELECT a.COUNTRY AS "国家", SUM(DECODE(a.SEX, 1, a.POPULCATION)) AS "男", SUM(DECODE(a.SEX, 2, a.POPULCATION)) AS "女" FROM populations a GROUP BY a.COUNTRY -------------------------------------- Case When 方式 SELECT a.COUNTRY AS "国家", SUM(CASE WHEN a.SEX = 1 THEN a.POPULCATION END) AS "男", SUM(CASE WHEN a.SEX = 2 THEN a.POPULCATION END) AS "女" FROM populations a GROUP BY a.COUNTRY -------------------------------------- PIVOT 方式 11G特有的方式 SELECT * FROM (SELECT a.COUNTRY AS "国家", a.SEX, a.POPULCATION FROM populations a) PIVOT( SUM(POPULCATION) FOR SEX IN(1 AS "男",2 AS "女"))