I want to add time in SQL Server. I have a column called checktime in the database which is a datetime datatype. I want to add the time from the column checktime. How can I do this ??
I'm doing this calculation for calculating total hrs an employee has worked during a specified day.
My database look like this.. I want to add the time from checktime where checktype = 1 and checktype = 2 and then subtract the results.
(checktype = 1 means check in and checktype = 2 means check out)
How can I do this??
Id EmpId CheckTime CheckType
---------------------------------------------------------------------------------
3 5 2013-01-03 09:00:15.000 1
4 5 2013-01-03 11:00:00.000 2
5 5 2013-01-03 11:30:00.000 1
6 5 2013-01-03 13:00:00.000 2
7 5 2013-01-03 13:30:00.000 1
8 5 2013-01-03 16:00:00.000 2
9 5 2013-01-03 16:30:00.000 1
10 5 2013-01-03 18:00:00.000 2