반응형

 

1)

SELECT TO_CHAR(V_DT,'YYYYMMDD') AS "일자"  , TO_CHAR(V_DT,'DAY') AS "요일" , DENSE_RANK() OVER(ORDER BY TRUNC(V_DT,'D'))||'주차' AS "주차"
FROM (
 SELECT (TO_DATE(S_DT,'YYYYMMDD') + LEVEL - 1) AS V_DT
 FROM (
  SELECT '20081221' AS S_DT, '20090107' AS E_DT
  FROM DUAL
 )
 CONNECT BY LEVEL <= TO_DATE(E_DT,'YYYYMMDD') - TO_DATE(S_DT,'YYYYMMDD') + 1
);

 

http://www.jumptovb.net/3


 

2)

일일 통계 조회시 필요한 쿼리..

 

시작일 : 2007-12-30

종료일 : 2008-03-20

 

SELECT TO_CHAR(TO_DATE('2007-12-30', 'yyyy-mm-dd') + (LEVEL - 1),'yyyy-mm-dd') dates
FROM dual
CONNECT BY LEVEL <= TO_DATE('2008-03-20','yyyy-mm-dd') - TO_DATE('2007-12-30','yyyy-mm-dd') + 1;

 

 

http://blog.naver.com/tsjang76/140044338232

반응형
Posted by 공간사랑
,