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, this should work:

db((db.requests.product==db.products.id) &
(db.products.id==3)).select(db.requests.whatever,
db.products.whatever, ...)

For clarity, in case anyone else should ever have to maintain the
code, it would be helpful if you renamed 'db.requests.product' to
'db.requests.product_id'




On Jul 28, 9:05 am, António Ramos <[email protected]> wrote:
> this
> db(db.requests.product==*db.products.id*==3).select()
>
> returns all field from *product* table only
>
> this
> db(db.products.id==*db.requests.product*==3).select()
>
>   returns all field from *requests* table only
>
> What is the logic?
>
> and if i want all record from both tables?
>
> thank you
> António

Reply via email to