Home » SQL & PL/SQL » SQL & PL/SQL » finding the nth salary
finding the nth salary [message #239818] Wed, 23 May 2007 06:35 Go to next message
sumitindiamca
Messages: 3
Registered: May 2007
Location: Delhi
Junior Member

Dear All,

Can anyone tell me the the procedure or the intricacies going under finding the nth highest/lowest salary.

like i have a query:

select distinct sal from emp e where 1 = (select count(distinct sal) from emp b where e.sal < b.sal)

it will find the 2nd highest salary But how it exactly works on Can anone explain it out.

Sumit Sharma
Re: finding the nth salary [message #239825 is a reply to message #239818] Wed, 23 May 2007 06:51 Go to previous message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
As this has been answered many and many times I think a little search will (would) give you the answer.

Btw, explain what don't you understand in the query?
Just follow it from inner part (right one here) to outer.

Regards
Michel

[Updated on: Wed, 23 May 2007 06:52]

Report message to a moderator

Previous Topic: Transpose of row to column
Next Topic: to get the number of rows inserted in a table
Goto Forum:
  


Current Time: Tue Dec 06 10:28:06 CST 2016

Total time taken to generate the page: 0.09261 seconds