반응형
http://blog.naver.com/PostView.nhn?blogId=smart_guy&logNo=220393069177
SELECT DATEADD(wk, DATEDIFF(d, 0, getdate()) / 7 - 1, 0) AS '저번주 월요일'
SELECT DATEADD(wk, DATEDIFF(d, 0, getdate()) / 7 - 1, 1) AS '저번주 화요일'
SELECT DATEADD(wk, DATEDIFF(d, 0, getdate()) / 7 , 0) AS '저번주 월요일'
SELECT DATEADD(wk, DATEDIFF(d, 0, getdate()) / 7 , 1) AS '저번주 화요일'
WHERE __ BETWEEN DATEADD(wk, DATEDIFF(d, 0, getdate()) / 7 , 0) and DATEADD(wk, DATEDIFF(d, 0, getdate()) / 7 , 6)
반응형
'데이터베이스 > MSSQL' 카테고리의 다른 글
MSSQL 오늘 (0) | 2018.07.11 |
---|---|
SELECT 문에 EXIST문사용 (0) | 2018.05.31 |
작업스케쥴러 (0) | 2018.04.19 |
INTERSECT(교집합), EXCEPT(차집합) (0) | 2018.01.31 |
DATEADD,DATEDIFF (0) | 2017.12.08 |