Query to get minutes and seconds

Hi All,

I'm trying to write a query which will give me difference between two datetime columns, but the problem is I get answer only in minutes or seconds. I want to have the answer as hh:mm:ss. Below is the query I'm using

For example

Results

X          y       [Total Time] (in mins)
abc     fcd      8

But I want

x          y        [Total Time] (in mm:ss)
abc    fcd        8:24


Thanks
SELECT X,Y,Z, DATEDIFF("n",[Start time], [End time]) as [Total Time]
FROM  [Table  A]

Open in new window

LVL 1
SamoinAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
SELECT X,Y,Z, CONVERT(varchar,[End time] -[Start time], 108)  as [Total Time]
FROM  [Table  A]
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.