php - Calculating working hours of employees using time stamps -


i have 4 columns in database includes employees name , time stamp of date , time combined shows time in , time out of employees. time out gets entered in next row after time in, each employee gets in , gets out many times in day, have consider first time in , last time out of each employee , find difference between time calculate total working hours of each employee. database given below. can please me on

e name              turnstile in        turnstile out               combine abhijit k t         sp turnstile 03 in                              2015-01-01 08:08:36 abhijit k t         sp turnstile 03 in                              2015-01-02 08:33:52 abhijit k t                             sp turnstile 01 out         2015-01-01 18:22:44 abhijit k t         sp turnstile 03 in                              2015-01-01 18:23:00 abhijit k t                             sp turnstile 01 out         2015-01-02 19:17:08 abhilash s m                            se turnstile 01 out         2015-01-02 12:08:08 abhilash s m        se turnstile 01 in                              2015-01-02 12:13:20 abhilash s m                            se turnstile 01 out         2015-01-02 13:07:20 abhilash s m        se turnstile 02 in                              2015-01-02 13:13:32 abhilash s m                            se turnstile 01 out         2015-01-02 13:13:24 abhilash s m                            se turnstile 03 out         2015-01-02 14:44:44 abhilash s m        se turnstile 01 in                              2015-01-02 14:50:16 abhilash s m                            se turnstile 01 out         2015-01-02 16:32:24 abhilash s m        se turnstile 01 in                              2015-01-02 16:37:28 abhilash s m        sp turnstile 03 in                              2015-01-02 08:33:32 abhilash s m                            se turnstile 01 out         2015-01-02 18:20:20 abhilash s m        se turnstile 01 in                              2015-01-02 18:20:28 abhilash s m        sp turnstile 03 in                              2015-01-02 18:25:44 abhilash s m                            sp turnstile 03 out         2015-01-02 18:28:24 abhilash s m        sp turnstile 03 in                              2015-01-01 10:27:40 abhilash s m                            se turnstile 01 out         2015-01-01 12:21:56 

it works me

select name,min(combine) intime,max(combine) outtime licensekeysubscription group name,date(combine) 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -