Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Find employee work hours in time range

Author  Topic 

testSQL2
Starting Member

2 Posts

Posted - 2008-07-17 : 12:52:59
Hello,
I have the table "EmployeesTimeWork" with the structure:

IdEmployee Date TimeIn TimeOut
------------------------- --------- ------------------


In other I have the 1 day ranges from the hours like
5-6,6-7,...12-13,..23:0,..to 4-5


I have sumarizing the total hours works by range but I'm not find the
solution.
The most complex situation-case is when the employe work start at
23hour (example) and
to finally at 3:00 (example)

A lot of thanks in advance and sorry for my english

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-17 : 12:55:35
so you want to populate the EmployeesTimeWork from day range data?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-17 : 20:43:27
It will be better if you can
- post your table DDL,
- sample data (in terms of insert . . . statement), do include the complex situation that you mention
- and also your expected result


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

testSQL2
Starting Member

2 Posts

Posted - 2008-07-18 : 04:43:13
Hi,
sorry for my last explanation.

I have a table where the employees registers at work, the start and the end of work.
The table fields structure is

** IdEmployee ** - employee code
** Date ** - Date start work
** HourIN ** - Date and hour employee start work
** HourOUT ** - Date and hour employee end work

I need to calculate the total hours works in a range.
For example, I have this records and I want to calculate the count hours in the range 18:00 to 19:00

IdEmployee Date HourIN HourOUT TotHours 18-19
1 17/7/2008 17/7/2008 17:50 17/7/2008 20:00 1
2 17/7/2008 17/7/2008 15:00 17/7/2008 18:20 0.20
1 18/7/2008 18/7/2008 18:30 19/7/2008 01:00 0.30

Thanks you in advance for your help
Go to Top of Page
   

- Advertisement -