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

  • SEARCH
  • Home
  • 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 8675857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:02:58+00:00 2026-06-12T20:02:58+00:00

I’m working in Teradata and am trying to calulate the average time a job

  • 0

I’m working in Teradata and am trying to calulate the average time a job completes.

Data Values:

Job Name            Start Date  End Date    End Time
D_BDW_CCIP_SRM_LD   10/10/2012  10/11/2012  01:41:49
D_BDW_CCIP_SRM_LD   10/9/2012   10/10/2012  00:19:56
D_BDW_CCIP_SRM_LD   10/8/2012   10/8/2012   23:37:18
D_BDW_CCIP_SRM_LD   10/5/2012   10/5/2012   23:39:47
D_BDW_CCIP_SRM_LD   10/4/2012   10/4/2012   23:42:47
D_BDW_CCIP_SRM_LD   10/3/2012   10/3/2012   23:41:54

The average is coming back with 16:07 instead of 00:07. What I need to happen is that the calculations where the job finishes next day understands that the time expanded.

In Excel I could do this by adding one day to the end time and then averaging and displaying as a time.

How do I do this in Teradata?

  • 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-12T20:03:00+00:00Added an answer on June 12, 2026 at 8:03 pm

    This seems to do the trick, but I’d be interested in seeing if there is another way.

    SELECT job_name,
        case when avg_end_time_in_minutes  > 60*24 then avg_end_time_in_minutes - 60*24 
             else avg_end_time_in_minutes end as avg_adjusted,
    case when max_end_time_in_minutes  > 60*24 then max_end_time_in_minutes - 60*24 
         else max_end_time_in_minutes end as max_adjusted,
    CAST((CAST(avg_adjusted / 60  AS INTEGER) (FORMAT '9(2)')) AS CHAR(2))||':'||
    CAST((CAST((avg_adjusted / 60 MOD 1)*60  AS INTEGER) (FORMAT '9(2)')) AS CHAR(2)) 
                            avg_adjusted_time,
    CAST((CAST(max_adjusted / 60  AS INTEGER) (FORMAT '9(2)')) AS CHAR(2))||':'||
    CAST((CAST((max_adjusted / 60 MOD 1)*60  AS INTEGER) (FORMAT '9(2)')) AS CHAR(2)) 
                               max_adjusted_time
    FROM (
    SELECT job_name,
        AVG(end_time_in_minutes) avg_end_time_in_minutes,
        MAX(CAST(end_time_in_minutes AS DECIMAL(8,2))) max_end_time_in_minutes
    FROM (
    SELECT job_name,
        CAST(substr(end_time, 1, 2) AS INTEGER)*60
            + CAST(substr(end_time, 4, 2) AS INTEGER) 
            + cast(end_date - start_date as integer)*60*24 AS end_time_in_minutes
    FROM dabank_prod_ops_tb.bdw_tables_load_tracker_view a          
    WHERE a.status = 'COMPLETED' 
    AND a.start_date BETWEEN CURRENT_DATE - 31 AND CURRENT_DATE -1
    AND a.end_time IS NOT NULL
    ) a
    GROUP BY 1
    ) b
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I

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.