I'd like to find last weeks dates
SELECT *
FROM Table
Where [Date] Between '04-Jan-2016' AND '15-Jan-2016'
Every time I run my SQL Query it needs to display last week
.
---To get the first day of the previous week in SQL Server, use the following code:
SELECT DATEADD(wk,DATEDIFF(wk,7,GETDATE()),0)
--To get the last day of the previous week:
SELECT DATEADD(wk,DATEDIFF(wk,7,GETDATE()),4)
SELECT *
FROM Table
Where [Date] Between DATEADD(wk,DATEDIFF(wk,7,GETDATE()),0)
AND DATEADD(wk,DATEDIFF(wk,7,GETDATE()),4)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With