how to get data of current week only in SQL server?

前端 未结 7 1973
逝去的感伤
逝去的感伤 2020-12-29 03:18

I want records from table which stores the current date when a record is inserted with in current week only.

I have tried:

SELECT PId 
,WorkDate 
,Ho         


        
相关标签:
7条回答
  • 2020-12-29 04:08

    datepart(dw, getdate()) is the current day of the week, dateadd(day, 1-datepart(dw, getdate()), getdate()) should be the first day of the week, add 7 to it to get the last day of the week

    0 讨论(0)
提交回复
热议问题