Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SQL Script for time in time format

Avatar of SQLSearcher
SQLSearcher asked on
Microsoft SQL ServerSQL
9 Comments1 Solution140 ViewsLast Modified:
Hello Experts Exchange
I have a table that has two columns [Tool Code] and [Total Down Time], I want to sum the time in the [Total Down Time] field grouped by the [Tool Code].  The [Total Down Time] column is in the format of 00:00:00.

When I run the following script the [Total Down Time] comes back as a decimal number but I want it to come back as a hour:minute:second format.

Select [Tool Code], Sum(DateDiff(Minute, '0:00:00',[Total Down Time])) as [Total Down Time]
From [dbo].[Acc_Data]
Where [Bay N°] = '3'
and [Reported Date] between '09/12/2014' and '09/12/2014'
Group by [Tool Code]
Order by [Tool Code]

Here is want is returned;
Tool Code      Total Down Time
D250                            78
DM25                            1216
M116                            413
M133                            106
Not Set                             82

I want to see something like this;
Tool Code      Total Down Time
D250                           01:18:00


Avatar of HainKurt
HainKurtFlag of Canada imageSr. System Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answers