query = ((db.owner.id==somevaluethatyousupply) &
         (db.retail.owner_id==db.owner.id) &
         (db.administer.retail_id==db.retail.id))
rows = db(query)select(db.administer.name)

The first line in the query gets the owner row.
The second line gets all the retails related to the owner.
The third line gets the administers related to the retails.

the call to select() gets the administer name.


On Nov 16, 11:31 pm, Cahya Dewanta <cahya...@gmail.com> wrote:
> Hello. Here's how I define my models:
>
> db.define_table('owner', Field('name'), format='%(name)s')
> db.define_table('retail', Field('owner_id', db.owner), Field('name'),
> format='%(name)s')
> db.define_table('administer', Field('retail_id', db.retail),
> Field('name'))
>
> How can I select all administers belong/related to a specified owner?
>
> Thank you so very much.

Reply via email to