• Alan.B - Sunday, May 21, 2017 7:18 PM

    I did this on my phone and cant test this but i think this is what you need.

    With yourData (rn, Emp_ID, Hour_Type, Start_Date, Hours, End_Date
    AS
    (
    SELECT
     1, 100, 'REG', '06/01/2016 8:00 AM', 4, '06/01/2016 12:00 PM' UNION ALL
    SELECT
    2, 100, 'SL', '06/01/2016 12:00 PM', 4, '06/01/2016 04:00 PM' UNION ALL
     SELECT
      3, 100, 'OT', '06/01/2016 04:00 PM', 2, '06/01/2016 6:00 PM'
    )
    SELECT
    a.Emp_ID,
    a.Hour_Type,
    a.Start_Date,
    a.Hours,
    End_Date = b.Start_Date
    FROM yourData a
    JOIN yourDats b ON a.rn = b.rn-1;

    You wrote code using your phone?  You're a braver man than I. 😉  I filled in your missing ) and fixed the joined name.

    WITH yourData(rn, Emp_ID, Hour_Type, Start_Date, Hours, End_Date) AS (
    SELECT 1, 100, 'REG', '06/01/2016 8:00 AM', 4, '06/01/2016 12:00 PM' UNION ALL
    SELECT 2, 100, 'SL', '06/01/2016 12:00 PM', 4, '06/01/2016 04:00 PM' UNION ALL
    SELECT 3, 100, 'OT', '06/01/2016 04:00 PM', 2, '06/01/2016 6:00 PM'
    )
    SELECT a.Emp_ID,
      a.Hour_Type,
      a.Start_Date,
      a.Hours,
      End_Date = b.Start_Date
    FROM yourData a
      JOIN yourData b ON a.rn = b.rn - 1;