-- ***********************************************-- Notice that the Clock In should be 07:36:00 not 12:07:00-- This would also get me to the correct Hours Worked-- ***********************************************

I used some of the code in another FORUM Posting pertaining to Clock In and Clock Out to get to this point.It works great as long as there is only ONE Clock In and ONE Clock Out Record for a day.But if there happens to be more than ONE of either, that's when the output is incorrect.

SELECT [Employee Number] , [Clock In] , [Clock Out] , (CASE WHEN CAST([Clock In] as SmallDateTime) = '1900-01-01 00:00:00' THEN '' WHEN CAST([Clock Out] as SmallDateTime) = '1900-01-01 00:00:00' THEN '' WHEN CAST([Clock In] as SmallDateTime) < CAST([Clock Out] as SmallDateTime) THEN CAST(CONVERT(DECIMAL,DATEDIFF(MINUTE,CAST([Clock In] as SmallDateTime),CAST([Clock Out] as SmallDateTime)))/60 as Varchar) ELSE '' END) [Hours Worked]FROM ( SELECT [Employee Number] , MAX(CASE WHEN [Clock In or Out] = 'Clock In' -- I believe this is the area where I am having the problem THEN CAST([Date] as SmallDateTime) -- I have tried MIN(CASE WHEN... but that does not seem to work for me either ELSE '' END) [Clock In] , MAX(CASE WHEN [Clock In or Out] = 'Clock Out' THEN CAST([Date] as SmallDateTime) ELSE '' END) [Clock Out]FROM ( SELECT [Employee Number] , [Clock In or Out] , CAST(CONVERT(VARCHAR(10),[Date],111) as Date) [Clock In or Out Date] , [Date]FROM [Test_Table] ) TableAGROUP BY [Employee Number] , [Clock In or Out Date] ) TableB

-- ***********************************************-- Output is not what I was trying for.-- Notice that the Clock In Time is 12:07:00-- I need it to be the other record which is 07:36:00-- ***********************************************

SELECT [Employee Number], X.[Dated], MIN(CASE [Clock In or Out] WHEN 'Clock In' THEN CONVERT(DATETIME,[Date]) ELSE CONVERT(DATETIME,'31 dec 2199') END) AS [Clock In], MAX(CASE [Clock In or Out] WHEN 'Clock In' THEN 0 ELSE [Date] END) AS [Clock Out]FROM [Test_Table]CROSS APPLY ( -- This just works out the date part without the time SELECT DATEADD(DAY,datediff(DAY,0,[Date]),0) AS [Dated] ) AS XGROUP BY [Employee Number], X.[Dated]

This worked PERFECTLY!!! I have extrapolated the code you provided and used it within my base code, ran it against 100k+ records and with only a little bit of formatting got the exact results I was expecting. I really appreciate your help with this.