I am trying to create a script where the on Mondays it pulls back information for Friday, Saturday and Sunday. For Tuesday - Friday, the script will pull back the previous day. Example Tuesday pulls Monday, Wednesday pulls Tuesday, ect.
However, I am having I am having a bit of trouble writing the case.
DECLARE @start DATETIME
DECLARE @end DATETIME
SET @start='2016-05-30'
SET @end=dateadd(dd,1,@start)
Where
orderdate.CreatedDt BETWEEN @start and @end
is what I have.
I have found other questions similar, but I do not know how to apply the information. ex: SQL WHERE depending on day of week