Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: First
Rene Nyffenegger <rene.nyffenegger_at_gmx.ch> wrote:
>> Hi,
>>
>> Does Qracle 9i support a SELECT that returns
>> only a subset of the records
>>
>> something link
>>
>> SELECT FIRST 1 * FROM tablename
>>
>> thx
>>
>> Peter
>
>Additionally, to the rownum suggested by others, there is the
>row_number() over (...) analytical function.
>
>The problem with rownum is that it doesn't work together with a
>order by clause. Well, it does, but most of the time, it doesn't
>return what was intended.
>
>Rene
Actually using an Order By in the correct place will work fine - it is just not very intuitive in its syntax.
select name from ( select name,rownum rn from (select
empl_nm name from mndot_employee
order by name))
where rn = 1
will return the 'first' of the sorted list... Received on Wed Aug 04 2004 - 12:56:48 CDT