Ok. One way is to use the represent attribute of db.requests.product field. You can setup this in models after the table definition with:
db.requests.product.represent = lambda id: db.product(id).description id is a parameter to lambda which takes the value of the current field value (for product). If you don't want to get "description" in place of "id" everytime you access db.requests.product, you can make the assignment above in the controller function. This way represent will only get set when that in calls to that function. details are at: http://web2py.com/book/default/chapter/06#Record-Representation 2011/7/28 António Ramos <[email protected]> > i want to select record from 2 tables. > I have table requests that have a column product. This column is only the > id of the product > to know the meaning of the id i have to connect the 2 tables to know the > product.description > > > thank you > > > 2011/7/28 Miguel Lopes <[email protected]> > >> The DAL is not SQL, it has a diferent logic. >> What are you trying to achieve? >> >> >> >> 2011/7/28 António Ramos <[email protected]> >> >>> 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 >>> >>> >> >

