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: Selects only the first 200 records aftering ordering from a table.

Re: Selects only the first 200 records aftering ordering from a table.

From: Ashish Sahasra <ashish_at_superlink.net>
Date: Sun, 19 Apr 1998 10:47:13 EDT
Message-ID: <6hd2ph$3ca$1@earth.superlink.net>


Try this

select A from your_table
where A in ( select A from your_table group by A)

    and rownum < 501;

Colin Woods <newsgroupcw_at_hotmail.com> wrote in article <3535FC1F.1FE9_at_hotmail.com>...
> Folks,
>
> Can anyone help me ?
>
> I have a large table, where I only want to select up to a maximum of 500
> records.
>
> I can't use ROWNUM because I want to perform an ORDER BY on the table
> before taking out the first 500 records.
>
> The statement I has was
>
> SELECT A, B, C
> FROM table
> WHERE Condition
> AND rownum < 500
> ORDER BY C, B
>
> What this select does is select 500 records, and then orders them.
>
> What I want is to order all records first, and then return the first
> 500(after ordering).
>
> Anyoue any ideas ?
>
> P.S. I don't want to use PL/SQL and a CURSOR select if possible !.
>
> THANKS
>
> Colin Woods.
>
Received on Sun Apr 19 1998 - 09:47:13 CDT

Original text of this message

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