I have a table that has two time columns. HourTimeFrom and HourTimeTo. I enter the times for activities in those columns as to when the begin and end.
I am trying to find overlapping times between records to see if there is duplication.. The code I use to find overlapping times is:
select count(*) from tblOrgHours where RegID = 74 And ActivityDate = '07/01/2014' And
((HourTimeFrom >= '09:00:00.0000000' And HourTimeFrom <= '09:00:00.0000000') Or
(HourTimeTo >= '10:00:00.0000000' And HourTimeTo <= '10:00:00.0000000') Or
(HourTimeFrom < '09:00:00.0000000' And HourTimeTo > '10:00:00.0000000'))
Am I on the right track to find those overlapping times with the above formula?