Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL selecting records
He's right, if you want the first 5 according to any sort of ranking system,
then you'll have to enclose the primary query inside of a SELECT * FROM(
query with conditions) WHERE rownum < 6.
If you don't have any sorting applied to the select statement, then you're
doing fine as is.
hth,
Joe
-- Joseph Ranseth - Webmaster World Cup Fishing http://www.worldcupfishing.com "TurkBear" <noone_at_nowhere.com> wrote in message news:ddvi8ts7s4bugfomlho0oiqomkqb06r4el_at_4ax.com...Received on Tue Feb 13 2001 - 12:45:51 CST
>
> Once again, caution is in order - The query listed will return 5 rows, but
not,
> in any real sense, the FIRST 5 rows..since in a RDBMS the concept first is
> undefined...
> If all you want is any 5 rows, this query is fine...
>
> "Happy" <allan_at_livvy80.freeserve.co.uk> wrote:
>
> >SELECT *
> >FROM table_name
> >WHERE column = criteria
> >AND rownum < 6;
> >
> >should return first five rows
> >
> >Cheers
> >Allan
> >
> >"Alan" <alwong_at_123infosys.com> wrote in message
> >news:lNYh6.1859$Vp.200052_at_newsread2.prod.itd.earthlink.net...
> >> I am trying to only get the first 5 records out of tables that met
certain
> >> criteria. Can I get these 5 records without getting all the records
that
> >> met certain criteria? Thanks.
> >>
> >>
> >>
> >
>
![]() |
![]() |