tiota Posted July 12, 2010 Share Posted July 12, 2010 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 More sharing options...
Mchl Posted July 12, 2010 Share Posted July 12, 2010 What datatypes are ts_timein and ts_timeout? Link to comment https://forums.phpfreaks.com/topic/207477-subtract-timeou-and-timein-in-mysql/#findComment-1084762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.