Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:43:53+00:00 2026-06-11T15:43:53+00:00

I have a table that has three columns. When the task was supposed to

  • 0

I have a table that has three columns.

  • When the task was supposed to start (nominalStartTime)
  • When it did start (startTime)
  • When it ended (endTime)

There around a bunch of tasks that are scheduled to run every 15 minutes. I need to know the difference between when the first task started and when the last task ended. For example, see below

  NominalStartTime  |  startTime  |   endTime
____________________|_____________|____________
2012-09-19 08:15:00 | 08:15:41.27 | 08:15:47.00
2012-09-19 08:15:00 | 08:15:45.13 | 08:15:45.43
2012-09-19 08:15:00 | 08:15:49.88 | 08:15:50.13
2012-09-19 08:30:00 | 08:30:25.27 | 08:30:26.00
2012-09-19 08:30:00 | 08:30:45.13 | 08:30:45.43
2012-09-19 08:30:00 | 08:30:49.88 | 08:30:50.13

I’m looking for the query to return

  NominalStartTime  |  startTime  |   endTime   | difference
____________________|_____________|_____________|____________
2012-09-19 08:15:00 | 08:15:41.27 | 08:15:50.13 | 00:00:08.86
2012-09-19 08:30:00 | 08:30:25.27 | 08:30:50.13 | 00:00:24.86

I tried this but I’m getting aggregate group by errors and the like

Select NominalStart, MIN(TimeStarted) as TimeStarted, MAX(TimeEnded) as TimeEnded, DATEDIFF(ms, TimeStarted, TimeEnded)
FROM taskRuns
GROUP BY NominalStart
ORDER BY NominalStart
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:43:54+00:00Added an answer on June 11, 2026 at 3:43 pm

    Try this solution:

    select NominalStart,min(TimeStarted),max(TimeEnded),
           DATEDIFF(ms ,min(TimeStarted),max(TimeEnded)) as difference
    from taskRuns
    group by NominalStart
    order by NominalStart
    

    SQL Fiddle Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that has three different date columns, so I set each
I have a table in my data base that has three columns: Screen, Icon,
I have a table that has two datetime columns (one for start time and
I have a table that has three columns: Category, Timestamp and Value. What I
I have a table that has three columns: myColumn, myColumn2 and myColumn3. The three
I have a gridview table that has three columns..fileID, uploadedBy and delete. Only the
I have a GradeConversionCriteria table for Student Exam that has three columns: FromNumber ToNumber
I have a table that has two columns, ID and Value. For this example
I have a task_id table which has two columns: `tid`:task id, `state`:0:unfinished,1:processing,2:finished It's easy
I have date range data in SQL DB table that has these three (only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.