Jump to content

subtract timeou and timein in mysql


tiota

Recommended Posts

I did substract between ts_timeout and ts_timein to find the number of hrs and it gave me strange values

 

guery

Select employee.dept_num,department.dept_desc, Sum(abs (ts_timein-ts_timeout)) AS NumOfHrs

From timesheet, employee, department

Where timesheet.emp_num = employee.emp_num

AND department.dept_num = employee.dept_num

AND ts_date Between "2010-07-01" AND "2010-07-01" Group By employee.dept_num;

 

output

 

 

+----------+----------------+----------+

| dept_num | dept_desc      | NumOfHrs |

+----------+----------------+----------+

| D01      | IT Department  |  335027 |

| E2501    | Administration |  242500 |

| E2502    | Accounts      |  1158200 |

+----------+----------------+----------+

 

The values under column 'NumOfHrs' supposed to be the number

of hrs spent by each department at a particular date. How to change that to number of hrs

 

Thanks in advance

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/207477-subtract-timeou-and-timein-in-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.