I create a query to get employees between two days before StartDate
and two days after EndDate
. It works fine for StartDate
that falls on Tuesday and Thursday. It won't work right if these days fall on Friday to Monday. I don't want to calculate on Saturdays and Sundays.
Here is my query:
select
FirstName,
LastName,
StartDate,
EndDate
from
Students
where
StartDate > GetDate()-2
AND EndDate < GetDate() +2
How do I change it to count weekdays only?
Thank you very much!