time different excluding overlap period

hello experts,

i m looking for a time difference between 2 data excluding the overlap period.

declare @tbl table(id int, startTime datetime, endTime datetime)

insert into @tbl values (1, '12/31/2014 09:00:00', '1/3/2015 09:00:00')
insert into @tbl values (2, '12/31/2014 09:00:00', '1/2/2015 09:00:00')

in above example, the overlap period is from '12/31/2014 09:00:00' to '1/2/2015 09:00:00'.

hence time difference excluding overlap period is from  '1/2/2015 09:00:00' to '1/3/2015 09:00:00' = 24 Hrs.

how to calculate this? data can be anything, the above data is just to put my issue explanation. thanks!

February 26th, 2015 3:10am

Is there some fields based on which you want to group and find non overlapping period? Or do you mean compare with every other record and determine nonoverlap?
Free Windows Admin Tool Kit Click here and download it now
February 26th, 2015 3:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics