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
 Development Tools
 ASP.NET
 Display sum of time in hh:mm:ss format that is ove

Author  Topic 

sbhavan_s
Starting Member

2 Posts

Posted - 2009-02-07 : 03:17:24
Following are the details of my ms access data fields
database name - daily
empname – text
starttime – date/time
endtime – date/time
I would like to get the total elapsed time for all the employees using visual studio 2005 in gridview and tried with this query with sqldatasource,
SELECT empname, format(SUM(endtime - starttime),'hh:nn:ss') AS totaltime FROM daily GROUP BY empname

And the result was,

Empname totaltime
Sara 04:49:06
Raja 07:47:49
Jaya 00:56:01

Everything seems ok at first look. This is really what I wanted.

But I wanted to double check the results with the data entered in to the access database. So I manually calculate the time for each employee. The results are correct for the first two employees (Sara and Raja).

But for the “Jaya” my manual calculation was – 24:56:01
My query result was – 00:56:01

I have lost 24 hrs.
So, I tried to enter some raw data to the employees and checked the result. I noticed that when the time goes over the 24hr I get a 24 hr less result.
I intend to calculate the total time for each employee in a weekly basis which approximately would be more than 60 hrs.

I need to get all the results in hh:mm:ss format. Example: 60:25:42

I believe this is possible with some slight changes in the above select query, but how?

Thanks in advance.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-07 : 03:25:09
See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=107275



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -