Here's a section on table and JOINs relationships from the web2py chapter on databases
To illustrate how to implement one to many relationships with web2py DAL, define another table called βdogβ that refers to the table βpersonβ, which we will redefine here:
>>> db.define_table('person',
Field('name'),
format='%(name)s')
>>> db.define_table('dog',
Field('name'),
Field('owner', db.person),
format='%(name)s')
You will need to provide additional information if you are looking for something that is not described in this link.
source
share