Here's a little addition to account for weekends. Note that this assumes Sunday is the first day of the week (i.e. SET DATEFIRST 7). Check your setting using SELECT @@DATEFIRST and amend the offsets if required.select startdate,useridfrom attendence us1where exists(select startdate,useridfrom attendence us2where us1.userid=us2.userid and datediff(day,us1.startdate,us2.startdate)= case when datepart(weekday, us1.startdate) = 6 then 3 else 1 end)and exists(select startdate,useridfrom attendence us3where us1.userid=us3.userid and datediff(day,us1.startdate,us3.startdate)= case when datepart(weekday, us1.startdate) in (5, 6) then 4 else 2 end)
Mark