Re: rownum

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Thu, 22 Feb 2001 10:06:15 -0000
Message-ID: <972oau$t36$1_at_soap.pipex.net>


This doesn't give TOP N but bottom N results. It is a neat solution for problems of this nature though.

--
Niall Litchfield
Oracle DBA
Audit Commission UK
"mrbaker001" <noreply_at_nowhere.com> wrote in message
news:Za_k6.4473$5U3.20806_at_NewsReader...

> Others have already come up with answers for Oracle8, but for 7.3+ (maybe
> earlier) you can still use an in-line view to achieve the result.
Although
> you may not be able to "order by" within it in Oracle 7, I'm pretty sure
you
> can still "group by" on a primary key value, which automatically always
> sorts (i.e. orders by) as a result.
>
>
> "Chaz" <chaz_at_hates.spam> wrote in message
> news:3a7f7a4b_at_newsserver1.intergate.ca...
> > can anyone help me find a way to limit the number of records returned in
a
> > select statement? here's what i mean:
> >
> > in MS SQL Server, the "TOP n" kewords (as in "SELECT TOP 10 fname FROM
> > table") specify how many records *out of the resultset generated from
the
> > rest of the select statement* are actually returned. in Oracle, the
closest
> > thing I've found is "WHERE rownum <= n". But this rownum is an internal
> > index, so it doesn't limit the resultset to the top n of that resultset,
but
> > to records whose rownum is <= n. Theres a huge difference here, and I'm
> > totally stumped.
> >
> > is there a similar keyword in Oracle?
> > do i have to spend the next week writing a stored proc to achieve this?
> > any clues?
> >
> > thx in advance.
> >
> >
> >
>
>
Received on Thu Feb 22 2001 - 11:06:15 CET

Original text of this message