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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting the first row from a select

Re: Getting the first row from a select

From: Robert Anderson <nospam_at_nospam.com>
Date: 1998/10/02
Message-ID: <3614E421.FE5@nospam.com>#1/1

DET wrote:
>
> Maybe I'm missing something obvious....
>

 <SNIP>
> Intuitively, I would have liked to be able to say:
>
> select * from COMPANY where COMPANY_NAME >= 'whatever' and ROWNUM = 1 order
> by COMPANY_NAME;
>
> but it turns out this doesn't work - ROWNUM is assigned before the sort is
> done.
>

 <SNIP>
> Any advice or suggestions?

This seems to work for me! Try It!

SELECT *
FROM COMPANY
WHERE COMPANY_NAME >= 'whatever'
AND ROWNUM < 2
ORDER BY COMPANY_NAME
by COMPANY_NAME;

Bob Anderson Received on Fri Oct 02 1998 - 00:00:00 CDT

Original text of this message

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