On Sun, Aug 22, 2010 at 17:49, Daniel Richter <daniel.rich...@student.hpi.uni-potsdam.de> wrote: > Nevertheless, (I think) it is possible to handle those ApplyExpressions. In > principle, the CROSS APPLY is a kind of a regular CROSS JOIN with some > special scope features.
Hi, that's only partially true. The right side of cross apply is also invoked for each element on left side and left side is know at that time. That means you can write something like: select foo, bar from t1 cross apply (select first t1.rowcount baz from t2 order by id); you can rewrite it using window functions, sure, but at least we should support FB2.1 and that means rewriting it to: select foo, bar from t1 join (select t2outer.baz, (select count(*) from t2 t2inner where t2inner.id <= t2outer.id) as count from t2 t2outer) t2 on (t1.rowcount = t2.count); Sure it's possible. But I have doubts it's doable in reasonable amount of time for every case that may happen. Especially if you think about nested queries. And that's only one particular case. Also take into account, that in SQL generation code, you don't know (or may not easily know), what's following, until you are there. :( Anyway if you know deterministic preferably one pass rewriting, let me know, I'll give it a try. -- Jiri {x2} Cincura (x2develop.com founder) http://blog.cincura.net/ | http://www.ID3renamer.com ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider