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
 

 

nth maximum of a column in a db2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
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

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
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
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 DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


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