SQL WHERE depending on day of week
问题 I have a requirement to check records up to differing dates, depending on which day of the week it is currently. On a Friday I need for it to look at the entire next week, until Sunday after next. On any other day it should check the current week, up until the coming Sunday. I have the below currently but it's not working due to syntax error. Is it possible to do a CASE WHEN inside a WHERE clause? WHERE T0.[Status] IN ('R','P') AND CASE WHEN DATEPART(weekday,GETDATE()) = '5' THEN T0.[DueDate]