question

new_man avatar image
new_man asked

count the number of hours the employee works

Dears i need to count the number of hours the employee works (Red column in below image). i have In / Out transactions * Every In followed by Out is complete transaction and then calculate the number of working hours. * If 1 In or 1 Out, we set the number of hours to ZERO

sql-server-2012datetimecount
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@new_man ...

If you were to provide the data in a readily consumable format, people would be more likely to help. In other words, provide the CREATE TABLE statement and the INSERT/VALUES statement to populate it. Make sure you test it so that you know it's going to work.

1 Like 1 ·

1 Answer

· Write an Answer
Jon Crawford avatar image
Jon Crawford answered

what have you tried, and why is it not working? Datediff() should be the solution for this one

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.