Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
nth maximum of a column in a db2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
rolen
Warnings : 1

New User


Joined: 26 Mar 2005
Posts: 6

PostPosted: Sat Apr 16, 2005 4:13 pm    Post subject: nth maximum of a column in a db2 table
Reply with quote

hi,
cananybosy give me the logic for finding the nth maximum of a column in a DB2 TABLE. if yes, plz write the select clause statement.
Back to top
View user's profile Send private message
References
PostPosted: Sat Apr 16, 2005 4:13 pm    Post subject: Re: nth maximum of a column in a db2 table Reply with quote

priyesh.agrawal

Global Moderator


Joined: 28 Mar 2005
Posts: 1512
Location: Chicago, IL

PostPosted: Wed Apr 27, 2005 2:01 pm    Post subject: Re: nth maximum of a column in a db2 table
Reply with quote

Check this earlier post :

http://www.ibmmainframes.com/viewtopic.php?t=1472&highlight=maximum

Regards,

Priyesh.
Back to top
View user's profile Send private message
nrsmca

New User


Joined: 25 May 2005
Posts: 14

PostPosted: Fri Jun 10, 2005 2:42 pm    Post subject: Re: nth maximum of a column in a db2 table
Reply with quote

Hi use this one...

SELECT a.SALARY FROM EMPTABLE a WHERE N = (SELECT COUNT(*) FROM EMPTABLE b WHERE b.SALARY >= a.SALARY) ;

It runs perfect.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1