Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting the first row from a select
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