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 Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm


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