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
 General SQL Server Forums
 New to SQL Server Programming
 Need help

Author  Topic 

krishnasv
Starting Member

1 Post

Posted - 2007-03-12 : 06:07:44
Can any one help me to solve this query.

I am provided with a table with fields,
Emap Id
Emp Name
Date
Time in
Time Out

I need to calculate the total hours an employee worked in a week.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-12 : 07:51:20
select [emp id], datepart(wk, date), sum(datediff(second, [time in], [time out])) / 3600.0
from table1
group by [emp id], datepart(wk, date)


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -