troubleshooting Question

Calculate time differance after midnight

Avatar of tonyfuzzy
tonyfuzzy asked on
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008
7 Comments1 Solution870 ViewsLast Modified:
Hello,

I am trying to write a SQL query for determining the amount of time between times in a table, that overlap midnight. I would like to have the time in seconds between the two times or idealy (HH:MM:SS), have tried datediff but comes up with a minus figure.

My table consists of an ID, start and finish time.

EG:
------------------------------------------------------
|   ID    |  Item_TimeA    |  Item_TimeB  |
------------------------------------------------------
00001 |    14:32         |       00:53
00002 |    23:54         |       00:34
00003 |    23:55         |       01:14
------------------------------------------------------



Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros