[web2py] Re: return record from a query only shows field from one table

2011-07-29 Thread Massimo Di Pierro
I have used both syntaxes. I have no strong preferences. On Jul 28, 11:02 am, pbreit wrote: > What was the final answer on creating compound queries like this: > > db(db.requests.product==db.products.id)(db.products.id==3).select() > > Is that acceptable or advisable? Or is the & way preferred?

[web2py] Re: return record from a query only shows field from one table

2011-07-28 Thread Cliff
I just do what the book says and it works; so I use the binary and operator between terms. Also you can split it across lines. Since I use descriptive (meaning too long) table and field names, it's helpful to be able to split. On Jul 28, 12:02 pm, pbreit wrote: > What was the final answer on cr

[web2py] Re: return record from a query only shows field from one table

2011-07-28 Thread pbreit
What was the final answer on creating compound queries like this: db(db.requests.product==db.products.id)(db.products.id==3).select() Is that acceptable or advisable? Or is the & way preferred? The & way has the benefit of being splittable across lines? Also, I think Field('product', db.product

[web2py] Re: return record from a query only shows field from one table

2011-07-28 Thread Anthony
If you're just fetching a single request at a time, you can also do a recursive select (see http://web2py.com/book/default/chapter/06#Recursive-selects): request = db(db.requests.id==3).select().first() description = request.product.description This is inefficient for multiple records (requ

[web2py] Re: return record from a query only shows field from one table

2011-07-28 Thread Cliff
Antonio, check out these references: http://www.web2py.com/book/default/chapter/06#Logical-Operators http://www.web2py.com/book/default/chapter/06#One-to-Many-Relation http://www.web2py.com/book/default/chapter/06#Many-to-Many Assuming 'db.requests.product' is a foreign key to your products table