Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

count of long running over average runtime

Hello,

Need help on building a SQL query in 19c DB to find the long running over the avg time.

Table columns:
run_id	  	Number
Name	Varchar2(255)
starttime Timestamp
Endtime	  Timestamp	

Average time for each name using:
select name, avg(cast(endtime as date) - cast(starttime as date)*1440) from tabA;

Now how can I write a  sql query to get count of (run_id) for each name which ran more than this avg run time?

Thanks
Srinivas
This post has been answered by mathguy on Jul 13 2023
Jump to Answer
Comments
Post Details
Added on Jul 12 2023
11 comments
617 views