Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get the first 10 records(with order by)?
There is a way.
It was taken from Ken Atkin's web site so all respect to him!
www.arrowsent.com/oratip/tip38.htm
There is a 'problem' with this method which he highlights so its best to go
to the link.
SQL> select empno, sal
2 from emp e1
3 where 10 > (select count(*) from emp e2
4 where e1.sal < e2.sal)
5 order by sal desc;
EMPNO SAL
---------- ----------
7839 5000 7788 3000 7902 3000 7566 2975 7698 2850 7782 2450 7499 1600 7844 1500 7934 1300 7521 1250 7654 1250
11 rows selected.
Mark
<wy_at_fudan.edu> wrote in message news:7t9gfi$ecq$1_at_nnrp1.deja.com...
> How to get the first 10 records in a sql(with order by)?
> In sqlserver7.0,
> I can use "select first 10 * from orders order by saledate" to get the
> first 10 records,and how to do this in oracle?
>
> any suggestions are helpful!
> thanks in advance!
>
>
> wangyang.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Oct 04 1999 - 08:50:58 CDT