Re: [web2py] Re: problems with linked fields using db[tablename]

2011-12-15 Thread Anthony
> > In the example you give in your first post you seems to have forget the > field you want to make a constraint for... > > in db(db.tablename.fieldname == something).select(...) this part > "db.tablename.fieldname == something" is equal to "where > tablename.fieldname = something" in raw SQL.

Re: [web2py] Re: problems with linked fields using db[tablename]

2011-12-15 Thread Richard Vézina
I don't think the act differently... db.tablename and db[tablename] are synonym I think and let you do something like this : db(db[request.args(0)].id == 1).select(...) Where request.args(0) is your table name coming from your URL... In the example you give in your first post you seems to have

[web2py] Re: problems with linked fields using db[tablename]

2011-12-15 Thread monotasker
OK, I found a workaround by doing a double inner-join: tb = db[tablename] rowlist = db((tb.author == db.authors.id) & (tb.work == db.works.id)).select() I'm still confused, though, by the difference between db.tablename and db[tablename]. Why do they act differently in queries?