I usually solve this kind of problem with recusive CTEs providing a counter for the records returned, thus a "simple" select statement can nicely filter on this kind of property without row numbers functionality.
Thomas Am 28.07.2014 23:09, schrieb 'Leyne, Sean' [email protected] [firebird-support]: > > > > >> >>> 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 > > -- Mit freundlichen Grüßen, Thomas Beckmann Diplom-Informatiker Wielandstraße 14c • 23558 Lübeck Tel +49 (22 25) 91 34 - 545 • Fax +49 (22 25) 91 34 - 604 Mail [email protected] <mailto:[email protected]> ASSFINET-Logo *ASSFINET Dienstleistungs-GmbH* Max-Planck-Straße 14 • 53501 Grafschaft bei Bonn [email protected] <mailto:[email protected]> • www.assfinet.de <http://www.assfinet.de/> Geschäftsführer: Dipl. Wirtschaftsinformatiker Marc Rindermann Registergericht Koblenz HRB 23331 Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. ------------------------------------ ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ------------------------------------ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
