• This should not be hard, I'm looking at this now.

    In the meantime, in case people want easily consumable sample data...

    SELECT * INTO dbo.test

    FROM

    (

    VALUES ('168780','10148','16477','7/21/2016 15:00','CLOCK_OUT','1','DAY','RICHAR'),

    ('168448','10148','16477','7/21/2016 11:38','CLOCK_IN','1','DAY','RICHAR'),

    ('169121','10148','16477','7/23/2016 7:00','CLOCK_IN','1','DAY','RICHAR'),

    ('169146','10148','16477','7/23/2016 9:00','CLOCK_OUT','1','DAY','RICHAR'),

    ('169148','10148','16477','7/23/2016 13:00','CLOCK_IN','1','DAY','RICHAR'),

    ('169340','10148','16477','7/23/2016 17:00','CLOCK_OUT','1','DAY','RICHAR'),

    ('169650','10148','16477','7/24/2016 5:42','CLOCK_IN','1','DAY','RICHAR'),

    ('175112','10148','16477','7/24/2016 16:45','CLOCK_OUT','1','DAY','RICHAR')

    ) t(action_id,person_num,person_id,creation_date,event_name,[SHIFT],middle_name,full_name);

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001