On 2 February 2012 07:40, shartha <[email protected]> wrote:

> I have two databases as follows:
>
> db.define_table('city',
>    Field('name'),
>    Field('state'),
>    format = '%(name)s'
> )
>
> db.define_table('users',
>   Field('name'),
>   Field('city',db.city),
>   Field('phone'),
>   Field('email')
> )
>
> What query will list all the users that are from a particular city,
> e.g. with id = 1?
>
>
Say 'Cape Town' is in 'city' then the following query would provide all the
users linked to that city:

list_of_users_in_cape_town = db((db.city.name == 'Cape
Town')&(db.users.city == db.city.id)).select()

Regards
Johnann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

Reply via email to