i have table like this
ID Date time
Emp1001 4/25/2012 00:02:12
Emp1001 4/25/2012 00:07:10
Emp1001 4/25/2012 00:08:20
I need to find the total time for the date=4/25/2012
I need the result like this totaltime = 00:17:42
i need query.....
thanks in advance....
How to addd a two times in asp.net using c sharp
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Keyur Narkhi62 reputationPosted Apr 25, 2012, 1:52 AM EDT
Here is the Query
SELECT EmpId, [Date], RIGHT(REPLICATE('0', 2) + cast(A.H as varchar),2) + ':' + RIGHT(REPLICATE('0', 2) + cast(A.M as varchar),2) + ':' + RIGHT(REPLICATE('0', 2) + cast(A.S as varchar),2) as [Time]
from (
SELECT EmpId, [Date], SUM(datepart(HOUR,[Time])) AS H, SUM(datepart(MINUTE,[Time])) as M, SUM(datepart(SECOND,[Time])) as S
FROM EmpTime
GROUP BY EmpId, [Date]
) as A
Hope this helps.
Kunal VaishyaRank #990 · 2K reputationPosted Apr 24, 2012, 11:24 PM EDT
After it to Convert into minute hrs
if any confusion then let me know
MuthuMari MRank #5,738 · 288 reputationPosted Apr 25, 2012, 12:41 AM EDT
pls refer this url
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=121027
thanks
If this post is useful then mark it as "Accepted Answer"