0

How to find the total hours between two dates row wise. I have a table named as activity which contains five columns as id,date,time,entry_type (0 Means out , 1 Means In) and eid.

In time column we have both the Intime and Outtime of the employee respectively. how to display both the Intime and Outtime separately of the respective employees.

Activity Table Strucuture

id   Date       time       entry_type    eid 
1  2017-04-14  01:31:47     1            2  
2  2017-04-14  02:31:47     0            2  
3  2017-04-14  02:35:47     1            2  
4  2017-04-14  02:55:60     0            2  
5  2017-04-14  03:00:00     1            2  

I need the output as below:

   id   Date       In time    Out Time   Total Hours 
    1  2017-04-14  01:31:47   02:31:47     ?           
    2  2017-04-14  02:35:47   02:55:60     ?         
    3  2017-04-14  03:00:00                   
Make
  • 15
  • 1
  • 8
  • follow the link - http://stackoverflow.com/questions/9521434/how-to-compare-two-dates-to-find-time-difference-in-sql-server-2005-date-manipu – Mumtaz Ahmad Apr 14 '17 at 09:19
  • 3
    Possible duplicate of [How to compare two dates to find time difference in SQL Server 2005, date manipulation](http://stackoverflow.com/questions/9521434/how-to-compare-two-dates-to-find-time-difference-in-sql-server-2005-date-manipu) – Malte Schwerhoff Apr 14 '17 at 10:10

0 Answers0