not_in = db(db.table2.id>0)._select(db.table2.column2)query = db(~db.table1.column1.belongs(not_in)).select()