Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Oracle and Top
You are pretty damn smug.
There are plenty of valid reasons to want to limit a "Contextual" query to a fixed number of results.
In article <3a3e4f31.5869660_at_spamkiller.news-ituk.to>,
See Message body for real address wrote:
> The problem here is one of Relational Database design...The 'order'
of the rows
> and,m hence, the row number, is meaningless....If you want to limit
the results
> based on a value ( or range of values) contained in one of the data
fields, that
> is a straightforward sql issue .. to try to limit based on something
like the
> rownum pseudocolumn may 'work' but will be simply data, not
information
> ( data = data, data in context = information, information in context =
> knowledge)
>
> aloisvogl_at_my-deja.com wrote:
>
> >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/
>
>
Sent via Deja.com
http://www.deja.com/
Received on Fri Jan 12 2001 - 15:37:49 CST