Hi, I get an error message when executing the following query: SELECT count(*) FROM _rank AS _rank1, _rank AS _rank2 WHERE _rank1.pre = 23 AND _rank2.pre = 33 AND EXISTS (SELECT 1 FROM _rank AS ancestor WHERE ancestor.pre < _rank1.pre AND _rank1.pre < ancestor.post AND ancestor.pre < _rank2.pre AND _rank2.pre < ancestor.post); The error message is: TypeException:user.s0_1[99]:'algebra.join' undefined in: _129:any := algebra.join(_128:bat[:oid,:oid], _108:bat[:int,:oid]) SQLException:SQLengine:Program contains errors A minimal example of test data to run this query follows: CREATE TABLE _rank (pre INTEGER, post INTEGER); INSERT INTO _rank VALUES (22, 37); INSERT INTO _rank VALUES (23, 24); INSERT INTO _rank VALUES (33, 34); Cheers, Viktor