Home Forums SQL Server 7,2000 T-SQL Combine overlapping datetime to return single overlapping range record RE: Combine overlapping datetime to return single overlapping range record

  • Sorry,... just to be clear on what I would expect, if I run for 1 employee this is what I get:

    Load Table

    850107:13:1307:18:04

    950107:13:1307:13:26

    1050108:35:5608:36:20

    1150108:35:5609:00:00

    1250114:08:0818:30:26

    1250115:45:2518:30:32

    Combined Result

    50107:13:1307:18:04

    50108:35:5609:00:00

    50114:08:0818:30:32

    When run for more than 1 employee these are the results:

    DKeyEmployeeIdLoginTimeLogOutTime

    150007:47:1908:03:05

    250007:47:1909:30:06

    350007:47:1919:55:32

    450009:47:0811:30:13

    550011:45:5613:14:51

    650013:47:3814:33:32

    750015:45:4919:55:27

    850107:13:1307:18:04

    950107:13:1307:13:26

    1050108:35:5608:36:20

    1150108:35:5609:00:00

    1250114:08:0818:30:26

    1250115:45:2518:30:32

    Result set

    EmployeeIdLogInTimeLogOutTime

    50107:13:1307:18:04

    50007:47:1919:55:32

    It doesnt group the data correctly

    Thanks

    Steve