nth Max row in a table-giving problem [message #2031] |
Tue, 18 June 2002 04:21 |
hanu
Messages: 21 Registered: March 2002
|
Junior Member |
|
|
The following query gives me the nth max row.
select a.sal from emp a
where &n = (select count(*) from emp b
where b.sal >= a.sal);
My problem is that, in case of duplicate rows it's giving the problem. Suppose the 4th and 5th rows are equal in that case, I am not getting the 4th max row and getting 5th Max row as two rows.
Can we say that it's correct. In fact, I should get 4th max row itself as 2rows.
How can get it?
Thanks in advance for your help
Hanu
|
|
|
|