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
 

 

The best optimum query to find nth highest salary

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
itssrikanth4u

New User


Joined: 21 Nov 2004
Posts: 9

PostPosted: Sat Dec 11, 2004 5:48 pm    Post subject: The best optimum query to find nth highest salary
Reply with quote

Hi,

Can any one please tell me the best optimum query to find nth highest salary?

bye
thanx in advance
take care
srikanth
Back to top
View user's profile Send private message

ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Mon Dec 20, 2004 4:36 pm    Post subject: Already answered many times.........
Reply with quote

Hi,

Once check and post one question only once. Other wise all of us are wasting time by opening duplicate queries. MODERATOR may not alert and aware about the things like duplicates. Please delete duplicates frequently and faciliate users.

If any one first opens this query for answer i dont want to disappoint them. So here is your answer...

SELECT SAL FROM TABLEA A WHERE N=(SELECT COUNT(DISTINT *) FROM TABLEA B WHERE A.SAL<=B.SAL);

FOR TOP N SALARIES JUST CHANGE CONDITION AS

N<= INSTEAD OF N=.

OK BYE,
O.V.Reddy.
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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am


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