IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Second max value


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ideas

New User


Joined: 25 May 2005
Posts: 52
Location: India

PostPosted: Wed Aug 03, 2005 11:28 am
Reply with quote

Hi All,

my query is how to Obtain Second maximum value from any table..

thnx.
Back to top
View user's profile Send private message
paru

New User


Joined: 24 Jun 2005
Posts: 9
Location: INDIA

PostPosted: Wed Aug 03, 2005 2:02 pm
Reply with quote

I can give you the logic if not the exact query to get this result.The answer you are searching is a subquery.Suppose you have to find the second maximum salary from EMPL table.
Try this :
SELECT MAX(SALARY) FROM EMPL WHERE
SALARY <(SELECT MAX(SALARY) FROM EMPL)

hope this helped! icon_smile.gif

Regards,
Paru.
Back to top
View user's profile Send private message
ideas

New User


Joined: 25 May 2005
Posts: 52
Location: India

PostPosted: Wed Aug 03, 2005 2:56 pm
Reply with quote

hey paru!! thanks. I tried and it worked fine.

icon_razz.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Search our Forums:

Back to Top