| Article: |
SQL Data Types | |
| Subject: | how do we find nth highest in SQL | |
| Date: | 2004-10-08 07:32:14 | |
| From: | gansin | |
| Please give the query for the finding the nth highest salary in SQL. | ||
Showing messages 1 through 21 of 21.
-
how do we find nth highest in SQL
2006-05-19 05:24:47 SPKUMAR [Reply | View]
ok -
how do we find nth highest in SQL
2006-07-11 22:39:42 prasanna1729 [Reply | View]
how do we find nth highest in SQL -
how do we find nth highest in SQL
2006-08-17 04:21:32 navingujar [Reply | View]
One more way, select min(sal) from (select distinct sal from emp order by sal desc) where rownum <=n
-
how do we find nth highest in SQL
2005-01-28 13:02:12 parangogoi [Reply | View]
Please help me with the above query -
how do we find nth highest in SQL
2005-10-17 23:29:32 Apurva_Sharma [Reply | View]
Hi,
Solution to your query.Plz follow steps.
Steps
SQL> SET Verify OFF;
SQL> SELECT min(sal)
FROM (SELECT sal
FROM emp
order by sal desc)
WHERE rownum<(&nth_heighest+1);
-
how do we find nth highest in SQL
2004-10-13 04:11:13 sunrek [Reply | View]
can u please help me
-
how do we find nth highest in SQL
2005-10-17 23:31:59 Apurva_Sharma [Reply | View]
Hi,
Solution to your query.Plz follow steps.
Steps
SQL> SET Verify OFF;
SQL> SELECT min(sal)
FROM (SELECT sal
FROM emp
order by sal desc)
WHERE rownum<(&nth_heighest+1); -
how do we find nth highest in SQL
2004-11-14 21:40:07 Question&answer [Reply | View]
To find the nth highest salary as below
select max(a.sal) from emp a where &n=(select count(b.sal) from emp b where (a.saloutput-
put the value of n and get the highest salary that u have give the number i;e 4,5,6,10 etc.
thanx,
Haribrat
-
how do we find nth highest in SQL
2004-12-11 08:17:00 RuchirAwadhawal [Reply | View]
Query for Nth Max (Highest)
select sal from emp t
where &n = (select count(sal)
from (select distinct sal from emp)
where t.sal<=sal);
<b>Query for Nth Min (Lowest)
select sal from emp t
where &n = (select count(sal)
from (select distinct sal from emp)
where t.sal>=sal); -
how do we find nth highest in SQL
2004-12-11 08:16:41 RuchirAwadhawal [Reply | View]
Query for Nth Max (Highest)
select sal from emp t
where &n = (select count(sal)
from (select distinct sal from emp)
where t.sal<=sal);
<b>Query for Nth Min (Lowest)
select sal from emp t
where &n = (select count(sal)
from (select distinct sal from emp)
where t.sal>=sal);





select * from qry1 where rownum=6;
This finds the 6th highest;