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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.