SELECT * FROM TB_OP_INCIDENT
PIVOT (COUNT(*) FOR INCIDENTCODE IN(1,2,3,4))
ORDER BY INCIDENTPROGRESS;
이 쿼리를 날려보니 에러가 납니다..
무슨이유일까요??
SELECT INCIDENTPROGRESS
, COUNT(DECODE(INCIDENTCODE,1,1,NULL))AS COUNT1
, COUNT(DECODE(INCIDENTCODE,2,1,NULL))AS COUNT2
, COUNT(DECODE(INCIDENTCODE,3,1,NULL))AS COUNT3
, COUNT(DECODE(INCIDENTCODE,4,1,NULL))AS COUNT4
FROM TB_OP_INCIDENT
GROUP BY INCIDENTPROGRESS
ORDER BY INCIDENTPROGRESS;
이 쿼리로는 결과값이 잘나옵니다