Re: Getting the first row from a select

From: Robert Anderson <nospam_at_nospam.com>
Date: 1998/10/02
Message-ID: <3614E421.FE5_at_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 CEST

Original text of this message