One of my clients, wanted to know the SQL script, to return data from the previous 4 weeks, from the last Friday
Solution:
--SET DATEFIRST 6;
SELECT DATEADD(DAY, -DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))as [Previous Friday],
DATEADD(WEEK,-3, DATEADD(DAY, -DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))) as [4 Fridays Ago]
If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us |