[web2py] Re: Many To Many Select

2010-06-29 Thread Al
Ah, belongs() + a clever select SQL. Thanks. Al On Jun 29, 7:04 pm, mdipierro wrote: > If I understand: > > for row in db(db.link_table.table1==r.id) > (db.table2.id==db.linked_table.table2).select(db.table2.id,db.table2.other)­: >     print row.id, row.other > > if no double links else > > sub=

[web2py] Re: Many To Many Select

2010-06-29 Thread mdipierro
If I understand: for row in db(db.link_table.table1==r.id) (db.table2.id==db.linked_table.table2).select(db.table2.id,db.table2.other): print row.id, row.other if no double links else sub=db(db.link_table.table1==r.id)._select(db.linked_table.table2) for row in db(db.table2.id.belongs(sub)).