Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL Select TOP in Oracle
As I am sure will be pointed out, that will not give the results expected...It
will give the first 10 records returned ( where dept =44) ( with random stuid
values or, at least, undetermined ) and THEN order them by stuid....
This is not the same as
select * from (select * from students where dept=44 order by stuid)
where rownum < 11;
This will return the first 10 stuids ( in order ) from dept=44
NOTE : the subquery order by clause requires 8.1.6 or higher, I believe....
Sakharov_J._at_f17.n5025.z2.fidonet.org (Sakharov J.) wrote:
>Select * from STUDENTS where DEPT =44 and rownum <11 order by STUID
>
>
>
>JF ÃÉÛÅÔ × ÓÃÃÂÃÅÎÉÉ <1323053370%RRZ96.3505$wL5.47074_at_NewsReader> ...
>>How do I limit the number of records returned in a select query i.e. in SQL
>>Server 7+ the following works
>>
>>Select Top 10 * from STUDENTS where DEPT =44 order by STUID
>>
>>Which will return the first 10 students
>>
>>I've tried looking in Oracle docs and can't find an equivalent to TOP
>>Help
>>
>>JF
>>
>>
>>
Received on Mon Jan 22 2001 - 09:26:27 CST