[oracle] 도메인별 접속통계 구하기 (집계 함수 활용)
--합계 OWITH parsed_visits AS ( SELECT REGEXP_SUBSTR(nvl(v_url,'직접'), '^(https?://)?([^/\\?]+)', 1, 1, NULL, 2) hn , COUNT(*) AS cnt FROM visiter GROUP BY ROLLUP(REGEXP_SUBSTR(nvl(v_url,'직접'), '^(https?://)?([^/\\?]+)', 1, 1, NULL, 2)))SELECT NVL(hn, '합계') AS hostname, cnt, ROUND(cnt / SUM(DECODE(hn, NULL, 0, cnt)) OVER () * 100, 1) AS rtrFROM parsed_visit..
2024. 12. 20.