I don't know what you're trying to do, but maybe you should read this http://web2py.com/books/default/chapter/29/6#Self-Reference-and-aliases
If you have products A, B and C; and, B and C relate to A; then that's what you need to read. > Any way to prevent this? Yes. Don't refer to the product table twice in your related product table. On Dec 26, 7:18 am, Jim Gregory <bikesatw...@gmail.com> wrote: > I am creating an application that has a one-to-many table that > references the same table twice: > > db.define_table('product', > Field('title', required=True, unique=True), > Field('sku', required = True, unique=True), > Field('description', 'text'), > format = '%(title)s' > ) > > db.define_table('related_product', > Field('product_id', db.product, writable=False), > Field('product', 'reference product'), > ) > > If I create a smartgrid on the 'product' table using: > def product(): > return dict(grid=SQLFORM.smartgrid( > db.product, > linked_tables=['related_product'], > )) > > the "related_product" table appears twice because it references the > "product" table twice. Any way to prevent this? > > -Jim