Hi,
I have a time-clock application that the staff uses to punch in and out when they come to work and leave (the data is then used to calculate their hours and print paychecks).
I was asked to provide a report showing the times each employee arrived to work during a period of time.
The table's structure is as follows:
EmployeeID (integer field)
TimeIn (datetime field)
TimeOut (datetime field)
When an employee comes in in the morning and leave for lunch, a record is created with his/her ID, the timedate of their arrival and the timedate of their departure.
An employee that takes lunch break or additional breaks throughout the day gets several records created for that day, typical data looks like this:
Employee TimeIn TimeOut
145 11/01/05 10:54am 11/01/05 2:15pm
112 11/01/05 10:57am 11/01/05 7:30pm
145 11/01/05 3:00pm 11/01/05 8:05pm
145 11/02/05 10:01am 11/02/05 1:34pm
90 11/02/05 1:14pm 11/02/05 3:00pm
145 11/02/05 2:14pm 11/02/05 8:11pm
90 11/02/05 3:40pm 11/02/05 7:44pm
From the above, I need to create a report that would show the following information:
Date Employee Time In
11/01/05 145 10:54am
11/01/05 112 10:57am
11/02/05 145 10:01am
11/02/05 90 1:14pm
Is there a simple sql way to do this?
Thanks!
Alex
Low-carb diet not working? Try the Low-food diet instead!