Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: First

Re: First

From: Turkbear <john.g_at_dot.spamfree.com>
Date: Wed, 04 Aug 2004 12:56:48 -0500
Message-ID: <8d82h0hsbna53dvjlgllfbil9lvk0gcj7q@4ax.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US