| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| arshadh Beginner
 
 
 Joined: 10 Jan 2007
 Posts: 33
 Topics: 12
 
 
 | 
			
				|  Posted: Wed Jul 11, 2007 9:14 am    Post subject: Help needed in Query using Count & max together |   |  
				| 
 |  
				| 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 only.
 
 How can i acheive tht..?[/code]
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Wed Jul 11, 2007 9:46 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| arshadh Beginner
 
 
 Joined: 10 Jan 2007
 Posts: 33
 Topics: 12
 
 
 | 
			
				|  Posted: Wed Jul 11, 2007 11:51 pm    Post subject: |   |  
				| 
 |  
				| Dear Kolusu, 
 Now I have posted the feedback for most of my queries..
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| bauer Intermediate
 
 
 Joined: 10 Oct 2003
 Posts: 317
 Topics: 50
 Location: Germany
 
 | 
			
				|  Posted: Thu Jul 12, 2007 1:07 am    Post subject: |   |  
				| 
 |  
				| arshadh, 
 
 "Now i want the fourth maximum row only . i.e " => and if two SRC_ENT_CD                have the same count ????
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |