Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Oracle and Top
Hi there,
I have a similar problem:
I am looking for something like the limit statment in MySQL.
eg: select * from tab limit 2, 4
This delivers the 2nd, 3rd and 4th record.
I tried:
select * from tab where rownum>=2 AND rownum<=4
but this does not work. It delivers 0 records.
but:
select * from tab where rownum<=4
works and delivers the 1st, 2nd, 3rd and 4th record.
Can anybody help me?
thanks in advance
Alois
In article <8vgsku$1vc$1_at_soap.pipex.net>,
"Niall Litchfield" <n-litchfield_at_audit-commission.gov.uk> wrote:
> Hi
>
> the pseudo column rownum allows you to limit rows returned to the
first x
>
> eg select * from tab where rownum < 11 gives the first 10 rows.
>
> However you will need (8i only) to do an order by in an inline query
to get
> the equivalent functionality to TOP in SQL server/Access.
>
> eg
>
> select * from
> (select * from tab order by 1 desc)
> where rownum < 11;
>
> regards
>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> "Ulrich Haucke" <uhaucke_at_netscape.net> wrote in message
> news:8vgq3m$4at8o$1_at_ID-58000.news.dfncis.de...
> > Hi everyone,
> >
> > I have a SQL-Statement that gives me back a very big result.
> > So I like to show only the top 10 or so.
> >
> > How can I do this?
> >
> >
> >
> >
>
>
Sent via Deja.com
http://www.deja.com/
Received on Mon Dec 18 2000 - 09:13:28 CST