Get a Specific Date

I need to get the date for the previous Friday to the current date , but if current date is Friday then return current date ie;

Today (T) , Prev Friday (F)

T = 05/02/2017 then F = 03/02/2017
T = 03/02/2017 then F = 03/02/2017
T = 02/02/2017 then F = 27/01/2017

DECLARE @date date
SET @date = GETDATE()

SELECT DATEADD(DAY, -DATEDIFF(DAY, 4, @date) % 7, @date) AS MostRecentFriday

1 Like

Perfect, Thank you