Manakel, I'm also pretty sure you need to use join. Here's my related forum post. http://groups.google.com/group/fameisfame/browse_thread/thread/3b5de92b728d3d5a/b7cbc4a3740b5ecc?q=#b7cbc4a3740b5ecc
On Dec 1, 8:40 am, Manakel <[email protected]> wrote: > Hello, > > I have a model with 2 tables with a "reference" relationship between > the two. > => the Budget has a type and the name/attributes of this type are > defined in the budget_types table. > > Now in a query on the budget table i would like to retrieve the name > of the Budget type and not the Budget Type id. > > My model is: > > db.define_table('budget_types',Field('name','string'),Field('description',' > string'),format='% > (name)s') > db.define_table('budgets',Field('name','string'),Field('monthly_amount','do > uble'),Field('type',db.budget_types),Field('view_order','integer'),format=' % > (name)s') > > My current query is : > > budget_list= > db().select(db.budgets.id,db.budgets.name,db.budgets.type,db.budgets.monthl > y_amount,orderby=db.budgets.view_order).as_list() > > I was thinking about doing > budget_list= > db().select(db.budgets.id,db.budgets.name,db.budgets.type.name,db.budgets.m > onthly_amount,orderby=db.budgets.view_order).as_list() > > but it fails. > > I guess i could do this with an explicit join but i thought there was > a "related" feature like in django ;-)

