On 29-7-2014 09:47, Svein Erling Tysvær [email protected] [firebird-support] wrote: > Don't know whether windowing functions can be used in the WHERE clause, but > when Firebird 3 is released, it would be tempting to try things like > > WHERE MOD(ROW_NUMBER() OVER (ORDER BY <something>), 5) = 2
You shouldn't be able to use window functions in a `WHERE`, only in the `SELECT` columnlist. The `ROW_NUMBER` is applied over the materialized rows, so you can't apply it in the filtering condition. You need a subquery or CTE with `ROW_NUMBER()` and then filter that in the outer select. Mark -- Mark Rotteveel
