> >>> On Jul 22, 2014, at 9:47 AM, "'checkmail' [email protected]
> >>> [firebird- support]" <[email protected]> wrote:
> >>> I would like to read every n record, depending on number of records.
> >>
> >> Do you care if your results are repeatable?  If so, you'll have to
> >> sort all the records then skip records in the result set.
> >
> >I don't think that the answer matters.
> >
> >Given that FB doesn't have the notion of ROW_Number within a result set, I
> don't see how the OP can filter to only see every nth row.
> 
> I thought this question was answered long ago (with MOD)... What about
> something like:
> 
> execute block returning(<resulting fields>) AS declare variable i integer;
> begin
>   i = 0;
>   for select <whatever> into <resulting fields> do
>   begin
>     i = i + 1;
>     if (i = 2) then suspend;
>     if (i = 5) then i = 0;
>   end
> end
> 
> I think this will return record 2, 7, 12 etc.(of course there would have to 
> be an
> ORDER BY for the result to be repeatable.

That certainly will work, but that is not a simple SELECT statement -- which is 
what I thought that the OP wanted/was looking for.


Sean

Reply via email to