Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need SQL for selecting TOP 25 Jobs under TOP 25 Owners

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Need SQL for selecting TOP 25 Jobs under TOP 25 Owners
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: 3158
Location: Tucson AZ

PostPosted: Tue May 01, 2007 10:12 pm    Post subject:
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    Post subject: Re: Need SQL for selecting TOP 25 Jobs under TOP 25 Owners
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    Post subject: Re: Need SQL for selecting TOP 25 Jobs under TOP 25 Owners
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Determine Region with max bandwidth f... seahawk789 COBOL Programming 3 Mon Feb 27, 2017 8:26 pm
No new posts How to show message using batch jobs madprasy TSO/ISPF 7 Fri Sep 09, 2016 6:55 pm
No new posts Don't allow CICS to submit batch jobs prino JCL & VSAM 5 Mon Jul 25, 2016 3:26 pm
No new posts Predicting jobs which are about to re... kpanchabhai85 DFSORT/ICETOOL 4 Thu Jun 30, 2016 7:51 pm
No new posts How to find jobs that are in schedule... anilkumar922 All Other Mainframe Topics 5 Tue Jun 28, 2016 10:01 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us