SELECT a.gb , COUNT(*) tot_cnt , COUNT(*) - COUNT(h.dt) wk_cnt , COUNT(h.dt) hu_cnt FROM (SELECT 1 no , 'Today' gb , TO_CHAR(sysdate, 'yyyymmdd') dt FROM dual UNION ALL SELECT 2 no , 'Month' gb , TO_CHAR(TRUNC(sysdate, 'mm') + LEVEL - 1, 'yyyymmdd') dt FROM dual CONNECT BY LEVEL <= TRUNC(sysdate, 'dd') - TRUNC(sysdate, 'mm') + 1 UNION ALL SELECT 3 no , 'Year' gb , TO_CHAR(TRUNC(sysdate, 'yy') + LEVEL - 1, 'yyyymmdd') dt FROM dual CONNECT BY LEVEL <= TRUNC(sysdate, 'dd') - TRUNC(sysdate, 'yy') + 1 ) a , 공휴일 h WHERE a.dt = h.dt(+) GROUP BY a.no, a.gb ORDER BY a.no ;