Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL:Getting the 'Nth' records from a table..

Re: SQL:Getting the 'Nth' records from a table..

From: <narayana_ck_at_my-deja.com>
Date: Mon, 27 Sep 1999 17:17:05 GMT
Message-ID: <7so8q5$jcv$1@nnrp1.deja.com>


Ted:
Thanks for the solution. The need is for some of our test engineers to ensure that the integrity of the data and also the application. Since the table is too large for them to test each row, they inherently want to pick up rows in an interval (say every 50th row) and test it. It is not feasible for them to test and verify each row. Hence the need.

Appreciate you immediate feedback
thanks
ck

In article <37ed00c6.17690823_at_news.compuserve.com>,   knijff_at_bigfoot.com (Ted Knijff) wrote:
> I don't know why but try :
> SELECT * FROM (SELECT ROWNUM xyz, Col1, Col2, Col3 FROM tablename)
> WHERE MOD(xyz,5)=1
> This will get Record 1, 6, 11 ...
> Whereas this will not work :
> SELECT * FROM (SELECT ROWNUM, Col1, Col2, Col3 FROM tablename)
> WHERE MOD(ROWNUM,5)=1
>
> Ted
>
> On Fri, 24 Sep 1999 18:03:54 GMT, narayana_ck_at_my-deja.com wrote:
>
> >I need to write a SQL query which can get the records from a table
with
> >a frequency of 'n'.
> >
> >Retrieve the 1st, 5th, 10th, 15th, 20th, 25th...
> >rows from a table.
> >
> >Is there a way to get it straight from SQL??
> >
> >thanks
> >ck
> >
> >
> >Sent via Deja.com http://www.deja.com/
> >Before you buy.
>
> EMail: knijff_at_bigfoot.com
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Sep 27 1999 - 12:17:05 CDT

Original text of this message

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