Hi Igor, Ah I just noticed how you wrote your query and it delivers for it indeed.
Here's an arbitrary example verifying its works. Neat - thanks! sqlite3 test.sqlite create table categories (id number); insert into categories (id) values (5),(10),(15); create table ot (v number); insert into ot (v) values (2),(4),(6),(8),(14),(16),(20); select id, a, b, 1.0 * a / b as c from ( select id, (select sum(v) from ot as ot1 where ot1.v > categories.id) as a, (select sum(v) from ot as ot2 where ot2.v < categories.id) AS b from categories ) order by c; Mikael 2013/7/21 Igor Tandetnik <i...@tandetnik.org> > On 7/20/2013 7:04 PM, Mikael wrote: > >> C is not a present column, but is the result of an expression involving A >> and B (namely, the expression A / B). >> > > Yes. And this is notable because...? > > > Can you please take this into consideration and update the query you >> proposed? :)) >> > > In what way do you believe the query as written is deficient? > > -- > Igor Tandetnik > > ______________________________**_________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users> > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users