Considering a table that contain informations with time intervals like this:
ID StartTime EndTime
==================================================
1 2012-11-22 06:14:10 2012-11-22 06:18:00
2 2012-11-22 06:16:10 2012-11-22 06:19:40
3 2012-11-22 06:20:50 2012-11-22 06:21:20
4 2012-11-22 06:22:30 2012-11-22 06:23:00
5 2012-11-22 06:22:10 2012-11-22 06:24:40
..................................................
..................................................
The problem is find the better t-sql way for calculate total seconds of these intervals considering intersections time only one time.
For example, total seconds of the first three records is 360.