네이버지식인...쿼리를 보니 약간 물이 흐려진 듯한 느낌이 들어 자책이 느껴지는 군요.
각설하고, 아래 결과를 확인 해 보세요.
문제에 설명하신 분류와 결과의 분류가 기준이 다르군요. 수정은 직접 해 보세요.
SELECT
ml.times
, SUM(CASE wHEN rn = 1 AND num1 BETWEEN 1 AND 10 THEN 1
WHEN rn = 2 AND num2 BETWEEN 1 AND 10 THEN 1
WHEN rn = 3 AND num3 BETWEEN 1 AND 10 THEN 1
WHEN rn = 4 AND num4 BETWEEN 1 AND 10 THEN 1
WHEN rn = 5 AND num5 BETWEEN 1 AND 10 THEN 1
WHEN rn = 6 AND num6 BETWEEN 1 AND 10 THEN 1 END) AS 분류1
, SUM(CASE wHEN rn = 1 AND num1 BETWEEN 11 AND 20 THEN 1
WHEN rn = 2 AND num2 BETWEEN 11 AND 20 THEN 1
WHEN rn = 3 AND num3 BETWEEN 11 AND 20 THEN 1
WHEN rn = 4 AND num4 BETWEEN 11 AND 20 THEN 1
WHEN rn = 5 AND num5 BETWEEN 11 AND 20 THEN 1
WHEN rn = 6 AND num6 BETWEEN 11 AND 20 THEN 1 END) AS 분류2
, SUM(CASE wHEN rn = 1 AND num1 BETWEEN 21 AND 30 THEN 1
WHEN rn = 2 AND num2 BETWEEN 21 AND 30 THEN 1
WHEN rn = 3 AND num3 BETWEEN 21 AND 30 THEN 1
WHEN rn = 4 AND num4 BETWEEN 21 AND 30 THEN 1
WHEN rn = 5 AND num5 BETWEEN 21 AND 30 THEN 1
WHEN rn = 6 AND num6 BETWEEN 21 AND 30 THEN 1 END) AS 분류3
, SUM(CASE wHEN rn = 1 AND num1 BETWEEN 31 AND 40 THEN 1
WHEN rn = 2 AND num2 BETWEEN 31 AND 40 THEN 1
WHEN rn = 3 AND num3 BETWEEN 31 AND 40 THEN 1
WHEN rn = 4 AND num4 BETWEEN 31 AND 40 THEN 1
WHEN rn = 5 AND num5 BETWEEN 31 AND 40 THEN 1
WHEN rn = 6 AND num6 BETWEEN 31 AND 40 THEN 1 END) AS 분류4
, SUM(CASE wHEN rn = 1 AND num1 BETWEEN 41 AND 50 THEN 1
WHEN rn = 2 AND num2 BETWEEN 41 AND 50 THEN 1
WHEN rn = 3 AND num3 BETWEEN 41 AND 50 THEN 1
WHEN rn = 4 AND num4 BETWEEN 41 AND 50 THEN 1
WHEN rn = 5 AND num5 BETWEEN 41 AND 50 THEN 1
WHEN rn = 6 AND num6 BETWEEN 41 AND 50 THEN 1 END) AS 분류5
FROM ml
, (SELECT ROWNUM AS rn FROM dict WHERE ROWNUM <= 6) cp
GROUP BY ml.times
ORDER BY ml.times