1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | -- 새것을 배우는 것도 좋지만... SELECT * FROM tb_op_incident PIVOT ( COUNT (*) FOR incidentcode IN (1, 2, 3, 4)) ORDER BY incidentprogress ; -- 옛것을 잘 사용하는 방법을 먼저 익히세요... SELECT incidentprogress , COUNT (DECODE(incidentcode, 1, 1)) cnt1 , COUNT (DECODE(incidentcode, 2, 1)) cnt2 , COUNT (DECODE(incidentcode, 3, 1)) cnt3 , COUNT (DECODE(incidentcode, 4, 1)) cnt4 FROM tb_op_incident GROUP BY incidentprogress ORDER BY incidentprogress ; |