Subject | Re: [firebird-support] select every nth row |
---|---|
Author | Helen Borrie |
Post date | 2009-04-21T05:15:59Z |
At 01:37 PM 21/04/2009, you wrote:
With a selectable stored procedure or (with Fb 2 or higher) an executable block that outputs a set. In essence, you figure out the ordered set from which you want to take the sample, initialise a counter and loop through through the set incrementing the counter at each turn. Each time your counter reaches n, you fill the output row with the current data, SUSPEND, and re-initialise the counter.
./hb
>Have a database with a lot of data. To simplify plotting I would like toAssuming you mean "sample" not "filter"....
>"filter" every nth row. Is there a way using a select statement to
>accomplish this?
With a selectable stored procedure or (with Fb 2 or higher) an executable block that outputs a set. In essence, you figure out the ordered set from which you want to take the sample, initialise a counter and loop through through the set incrementing the counter at each turn. Each time your counter reaches n, you fill the output row with the current data, SUSPEND, and re-initialise the counter.
./hb