SELECT
CPCODE
, TO_CHAR(CRETIME, 'HH24') "CRETIME"
, NTFCODE "NTFCODE"
, COUNT(NTFCODE) "CNT"
FROM
LOG
WHERE
TO_CHAR(CRETIME, 'MM/DD') = TO_CHAR(SYSDATE-2, 'MM/DD')
GROUP BY
CPCODE, TO_CHAR(CRETIME, 'HH24'), NTFCODE;
CPCODE CR N CNT
------- -- - ----------
AP0010 10 t 2
AP0010 11 t 8
AP0010 11 v 1
AP0010 13 t 5
AP0010 14 t 6
AP0010 15 t 6
AP0010 16 t 1
AP0010 17 t 6
의 결과와
SELECT DISTINCT(NTFCODE) FROM LOG
N
-
O
Q
d
f
i
j
k
m
n
t
v
의 결과를 이용해서
CPCODE CR N CNT
------- -- - ----------
AP0010 00 O 0
AP0010 00 Q 0
AP0010 00 d 0
AP0010 00 f 0
AP0010 00 i 0
AP0010 00 j 0
AP0010 00 k 0
AP0010 00 m 0
AP0010 00 n 0
AP0010 00 t 0
AP0010 00 v 0
.
.
.
AP0010 10 O 0
AP0010 10 Q 0
AP0010 10 d 0
AP0010 10 f 0
AP0010 10 i 0
AP0010 10 j 0
AP0010 10 k 0
AP0010 10 m 0
AP0010 10 n 0
AP0010 10 t 2
AP0010 10 v 0
AP0010 11 O 0
AP0010 11 Q 0
AP0010 11 d 0
AP0010 11 f 0
AP0010 11 i 0
AP0010 11 j 0
AP0010 11 k 0
AP0010 11 m 0
AP0010 11 n 0
AP0010 11 t 8
AP0010 11 v 0
AP0010 12 O 0
AP0010 12 Q 0
AP0010 12 d 0
AP0010 12 f 0
AP0010 12 i 0
AP0010 12 j 0
AP0010 12 k 0
AP0010 12 m 0
AP0010 12 n 0
AP0010 12 t 0
AP0010 12 v 0
.
.
.
AP0010 23 O 0
AP0010 23 Q 0
AP0010 23 d 0
AP0010 23 f 0
AP0010 23 i 0
AP0010 23 j 0
AP0010 23 k 0
AP0010 23 m 0
AP0010 23 n 0
AP0010 23 t 0
AP0010 23 v 0
이렇게 만들여면 어떻게 해야 되나요 하루종일 쿼리가지고
이래저래 해보다가 안되서 부탁드립니다.