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 Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.