IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need SQL for selecting TOP 25 Jobs under TOP 25 Owners


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Tue May 01, 2007 8:51 pm
Reply with quote

Hi,
My requirement is like this.
I have two tables
BatXMIT - having details about batch jobs, CPU time and CPU cost
APPLINV - Having Jobgroups, application Ids and owners

I need to get TOP OWNERS by SUM(CPUtime) and SUM(CPU COST)
which can be done by orderby desc on the sum fields and fetch only 25 rows. I am able to get the result till here.
In addition to that I need to get "TOP 25" jobs under each Owner.
So it will be 25 * 25 rows.

Can someone help me with this?
Any pointers will be of more help.
Thanks,
Viji
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue May 01, 2007 10:12 pm
Reply with quote

Can't you use the selected "TOP 25" owners as the selection criteria for the select of their jobs?
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Tue May 01, 2007 10:20 pm
Reply with quote

Yes. I did that. But, the result is the TOP 25 jobs of all of them and not per individual.
Say for Owner ABC, 10 top jobs exists and for owner XYZ 15 jobs.
then my result is top 25 from the list of 10+15 jobs and not per owner!

Hope I am clear.
Thanks,
Viji
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Wed May 02, 2007 5:45 am
Reply with quote

You earlier said that you want 25*25 rows. Are you now saying that there may not be 25 job for each owner and some may have a maximum of 10 or 15 for example?

Please post column names for each of the two tables. And the relation(column name) by which the two tables are related to each other.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Help in Automating Batch JCL jobs mon... JCL & VSAM 3
No new posts Submit multiple jobs from a library t... JCL & VSAM 14
No new posts Ca7 long running jobs report All Other Mainframe Topics 1
No new posts Report of batch jobs JCL & VSAM 1
Search our Forums:

Back to Top