• Please help support our sponsors by considering their products and services.
    Our sponsors enable us to serve you with this high-speed Internet connection and fast webservers you are currently using at ADSM.ORG.
    They support this free flow of information and knowledge exchange service at no cost to you.

    Please welcome our latest sponsor Tectrade . We can show our appreciation by learning more about Tectrade Solutions
  • Community Tip: Please Give Thanks to Those Sharing Their Knowledge.

    If you receive helpful answer on this forum, please show thanks to the poster by clicking "LIKE" link for the answer that you found helpful.

  • Community Tip: Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING)

    Click the link above to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This notice will disappear after you have made at least 3 posts.

Getting the average elapsed time from the event table

rdemaat

ADSM.ORG Member
#1
Hello,

I'm trying to get the average elapsed time for schedules from the event table. There are 14 entries per schedule. I want to add all 14 elapsed times and then average them. I have a couple select examples below but I've tried many different scenarios. The minutes column number should never be higher than 59. The first example shows 64 in the minutes column. The second example appears to be the same numbers just listed in a different format. I get the feeling I'm just adding elapsed time 'numbers' and averaging that number. Is it even possible to total 14 different HH:MM:SS time entries and then get the average of that time total? Thanks for any help you can give me on this.

NAHOLLAP846>
SELECT schedule_name, TRANSLATE('a bc:de:fg', DIGITS(AVG(completed-actual_start)), '_______abcdefgh_____',' ') as avg_runtime FROM events WHERE schedule_name like '%DM3-4%' and status = 'Completed' group by schedule_name

SCHEDULE_NAME AVG_RUNTIME
VM_DM3-4 0 00:64:91


NAHOLLAP846>
SELECT schedule_name, avg(time(completed) - time(actual_start)) as avg_runtime FROM events WHERE schedule_name like '%DM3-4%' and status = 'Completed' group by schedule_name

SCHEDULE_NAME AVG_RUNTIME
VM_DM3-4 6,491.857
 

rdemaat

ADSM.ORG Member
#2
After searching some more in this forum I found this below that works. Output is in minutes. It would be nice to have it convert back to HH:MM:SS but not a big deal.

SELECT schedule_name, cast(avg(timestampdiff(4,completed - actual_start)) as dec(12,0)) avg_runtime FROM events WHERE schedule_name like '%DM-6%' and status = 'Completed' group by schedule_name

SCHEDULE_NAME AVG_RUNTIME
VM_DM-6 17


NAHOLLAP846>
SELECT schedule_name, cast(avg(timestampdiff(4,completed - actual_start)) as dec(12,0)) avg_runtime FROM events WHERE schedule_name like '%DM4-1%' and status = 'Completed' group by schedule_name

SCHEDULE_NAME AVG_RUNTIME
VM_DM4-1 149

But if there are any other suggestions anyone has please pass them on. Thanks.
 

Advertise at ADSM.ORG

If you are reading this, so are your potential customer. Advertise at ADSM.ORG right now.

UpCloud high performance VPS at $5/month

Get started with $25 in credits on Cloud Servers. You must use link below to receive the credit. Use the promo to get upto 5 month of FREE Linux VPS.

The Spectrum Protect TLA (Three-Letter Acronym): ISP or something else?

  • Every product needs a TLA, Let's call it ISP (IBM Spectrum Protect).

    Votes: 17 19.5%
  • Keep using TSM for Spectrum Protect.

    Votes: 53 60.9%
  • Let's be formal and just say Spectrum Protect

    Votes: 10 11.5%
  • Other (please comement)

    Votes: 7 8.0%

Forum statistics

Threads
31,469
Messages
134,129
Members
21,569
Latest member
srinathkodela
Top