MSSQL Get Last Monday and Last Sunday

获取上周的周一和周日

代码:

--start of last week
SELECT DATEADD(wk, DATEDIFF(wk, 6, GETDATE()), 0)

--end of last week
SELECT DATEADD(wk, DATEDIFF(wk, 6, GETDATE()), 6)

 

posted @ 2016-07-26 09:15  木子执手  阅读(168)  评论(0编辑  收藏  举报