I have a database which stores timein and timeout of staff in some company, I try to calculate the number of hrs spend by each staff on a particular day by running this query.
Select emp_num, ts_timein , ts_timeout, abs(ts_timein-ts_timeout) AS NumberOfHrs
From timesheet Where ts_date = “2010-07-01”;
Results:
±--------±----------±-----------±------------+
| emp_num | ts_timein | ts_timeout | NumberOfHrs |
±--------±----------±-----------±------------+
| 2010ab | 08:04:00 | 04:16:00 | 38800 |
| 2002150 | 08:04:00 | 04:17:00 | 38700 |
| 2009207 | 08:04:00 | 04:21:00 | 38300 |
| 2002147 | 08:04:00 | 04:39:00 | 36500 |
| 456116 | 08:05:00 | 04:20:00 | 38500 |
| 2009205 | 08:05:00 | 16:20:00 | 81500 |
| 2002149 | 08:05:00 | 00:00:00 | 80500 |
| 456105 | 08:06:00 | 00:00:00 | 80600 |
| 2009211 | 08:06:00 | 04:18:00 | 38800 |
| 2010A | 08:06:00 | 00:00:00 | 80600 |
| 91048 | 08:06:00 | 00:00:00 | 80600 |
The column NumberOfHrs contains strange values. How can I change them to number of hrs ?
Help is pretty appriated …