| Article: |
SQL Data Types | |
| Subject: | how do we find nth highest in SQL | |
| Date: | 2005-09-21 00:22:18 | |
| From: | SachinJindal | |
|
Response to: how do we find nth highest in SQL
|
||
Showing messages 1 through 5 of 5.
-
how do we find nth highest in SQL
2005-09-25 23:53:22 rajib4study [View]
-
how do we find nth highest in SQL
2006-02-01 02:50:14 neerenderlamp [View]
i 2 don't know really iam searching for that -
how do we find nth highest in SQL
2006-04-17 07:57:07 sainiks [View]
1.
Select * from Employee where salary =
(Select max(Salary) from Employee where salary < (Select max(Salary) from Employee where
Salary<(Select max(Salary) from Employee where
Salary <…………………………………………… N
The above query can be continued n timesif you require nth highest salary
2.
Select * From Employee E1 Where
(N-1) = (Select Count(Distinct(E2.Salary)) From Employee E2 Where
E2.Salary > E1.Salary)
here you require N th highest salary
Those were two choices , i think 2nd one will take a bit time.
-
how do we find nth highest in SQL
2006-06-27 05:16:28 jewel_plat [View]
could u please explain me how does the 2nd code works. -
how do we find nth highest in SQL
2006-09-05 03:32:25 kunalpawar [View]
this is the shortest and easiest way i fill to found nth higest....
select min(e.salary) from
(select salary from employees order by salary desc) e
where rownum <= n;


