On 6.6.2013 19:33, Michael Bayer wrote: > > On Jun 6, 2013, at 12:56 PM, Ladislav Lenart <lenart...@volny.cz> wrote: > >> Hello. >> >> I have already solved the issue by using subquery: >> >> SELECT >> t.id AS t_id, >> t.rownum AS t_rownum >> FROM ( >> SELECT >> FROM >> foo.id AS id, >> row_number() OVER (ORDER BY foo.id) AS rownum >> ) AS t >> WHERE rownum % 50 = 1 >> >> I have just tried your suggestion about using HAVING instead of WHERE, but >> that >> fails with the same error. Thus a label cannot be used inside a query. >> >> However, I am still curious whether the original WindowedRangeQuery recipe at >> >> http://www.sqlalchemy.org/trac/wiki/UsageRecipes/WindowedRangeQuery >> >> works or also has this error. > > the recipe as you noted uses from_self(), which means, "wrap myself in a > subquery", so that's where the necessary subquery is applied.
That explains it :-) Thank you, Ladislav Lenart -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.