MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help needed in Query using Count & max together

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
arshadh
Beginner


Joined: 10 Jan 2007
Posts: 33
Topics: 12

PostPosted: Wed Jul 11, 2007 9:14 am    Post subject: Help needed in Query using Count & max together Reply with quote

I have a table called ABA_ENT With ABA_NO as Primary key.
Code:

SRC_ENT_CD  ABA_NO   
---------+---------+--
075         063100620
172         061101663
295         056007387
172         061110049
172         061200865
172         061000052
406         061302417
172         061000078
172         061001323
075         063000047
075         063100264

---sample--------

 


The following query lists me the count of ABA grouped by SRC_ENT_CD
Code:
SELECT SRC_ENT_CD,COUNT(ABA_NO) FROM   
ABA_TO_ENTITY                   
GROUP BY SRC_ENT_CD                   
...

The result is
Code:

---------+---------+------
SRC_ENT_CD               
---------+---------+------
001                  14   
005                   5   
035                  47   
075                  51   
078                   5   
099                  15   
132                   1   
134                   1   
172                   8   
280                  27   


Now i want the fourth maximum row only . i.e

row
Code:

099  15
only.

How can i acheive tht..?[/code]
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Jul 11, 2007 9:46 am    Post subject: Reply with quote

arshadh,

Go back and please post a feedback for all the answers you received on this board

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
arshadh
Beginner


Joined: 10 Jan 2007
Posts: 33
Topics: 12

PostPosted: Wed Jul 11, 2007 11:51 pm    Post subject: Reply with quote

Dear Kolusu,

Now I have posted the feedback for most of my queries..
Back to top
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Thu Jul 12, 2007 1:07 am    Post subject: Reply with quote

arshadh,


"Now i want the fourth maximum row only . i.e " => and if two SRC_ENT_CD have the same count ????
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group