2009. 12. 3.

달력

SELECT sum(decode(A.A2,'1',A.A3,null)) 일,
  sum(decode(A.A2,'2',A.A3,null)) 월,
  sum(decode(A.A2,'3',A.A3,null)) 화,
  sum(decode(A.A2,'4',A.A3,null)) 수,
  sum(decode(A.A2,'5',A.A3,null)) 목,
  sum(decode(A.A2,'6',A.A3,null)) 금,
  sum(decode(A.A2,'7',A.A3,null)) 토
FROM (SELECT rownum + 7 - to_number(TO_CHAR(TO_DATE('200802'||TO_CHAR(rownum),'YYYYMMDD'),'D')) as A1,
    TO_CHAR(TO_DATE('200802'||TO_CHAR(rownum),'YYYYMMDD'),'D') AS A2,
    rownum as A3
  FROM    all_objects
  WHERE rownum <= 31
  AND  rownum > 0
  AND  TO_CHAR(LAST_DAY(TO_DATE('200802'||'01','YYYYMMDD')),'DD')>=LTRIM(TO_CHAR(rownum,'00')) ) A
GROUP BY A.A1;

- 08년 3월 7일 16시 10분 -

댓글 없음:

댓글 쓰기