Thanks Lucas There were some typo :
rows_res = db(db.tab1_res)._select(db.tab1_res.tab1_id) rows = db(~db.tab1.tab1_id.belongs(rows_res)).select() Richard On Tue, Feb 15, 2011 at 12:57 PM, Lucas D'Avila <[email protected]> wrote: > Hi! > > Try this: > > rows_res = db(db.tab1_res)._select(db.tab1_res.tab1_id) > rows = db(not db.tab1.tab1_id.belong(rows_res)).select() > > -- > > Lucas D'Avila > http://flavors.me/lucasdavila > Em 15/02/2011 15:09, "Richard Vézina" <[email protected]> > escreveu: > > > Hello, > > > > I would like to write this in web2py : > > > > SELECT tab1.tab1_id > > FROM tab1 > > WHERE tab1.tab1_id NOT IN (SELECT tab1_res.tab1_id FROM tab1_res) > > > > Try this without success : > > > > db(db.tab1.tab1_id != > > (db().select(db.tab1_res.tab1_id))).select(db.tab1.ALL) > > > > Thanks > > > > Richard >

