A question about top n values [message #202722] |
Sat, 11 November 2006 05:29 |
prince973
Messages: 37 Registered: November 2006
|
Member |
|
|
hi all
if we want to get the min two salaries from scott.emp table we do the following:
select sal,rownum from
(select sal from emp order by sal)
where ROWNUM<3;
and we get :
SAL ROWNUM
---------- ----------
800 1
950 2
my question is , what if i want to get the second min salary only , i tried this :
select sal,rownum from
(select sal from emp order by sal)
where ROWNUM=2;
no rows selected
as u can see , i got no result .
what is ur opinion??
|
|
|
|
|
|