Does this help: http://web2py.com/book/default/chapter/06#Self-Reference-and-Aliases
On Saturday, September 3, 2011 5:36:12 PM UTC-4, Noel Villamor wrote: > > TABLE db.tblB > fkA, name, data > 1,100,'aaa' > 1,101,'bbb' > 1,102,'ccc' > 2,100,'xxx' > 2,101,'yyy' > > 1st query: db(db.tblB.fkA == 1).select(db.tblB.name,db.tblB.data) > name,data > 100,'aaa' > 101,'bbb' > 102,'ccc' > > 2nd query: db(db.tblB.fkA == 2).select(db.tblB.name,db.tblB.data) > name,data > 100,'xxx' > 101,'yyy' > > Desired left join result: > 100,'aaa','xxx' > 101,'bbb','yyy' > 102,'ccc',None > > I could do this in SQL but I do not know how to use aliases in web2py. > Thank you for the replies Massimo and pbreit. >