■ GENERATE_SERIES 함수 : 1주일치 날짜 구하기

------------------------------------------------------------------------------------------------------------------------

 

SELECT

    DATE_TRUNC('WEEK', CURRENT_DATE)::DATE - 1 + I AS "일요일~토요일"

   ,DATE_TRUNC('WEEK', CURRENT_DATE)::DATE     + I AS "월요일~일요일"

FROM GENERATE_SERIES(0, 6) AS T(I);

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG