I'm guessing you had it wrong....

db(main_table.filter == something).select(
    main_table, other_table, 
    left=[other_table.on(main_table.some_id == other_table.reference), ....
    ]
)



On Wednesday, January 22, 2014 10:24:14 PM UTC+1, Apple Mason wrote:
>
>
> I have the following tables:
>
>
> db.define_table('person',
>     Field('name', 'string'))
>
> db.define_table('pet',
>     Field('name', 'string'),
>     Field('person_id', 'reference person'))
>
> db.define_table('thing',
>     Field('name', 'string'),
>     Field('person_id', 'reference person'))
>
> I have a person_id given to me, so I want all information about that 
> person (person's name, all pets, all things).
>
> I am trying left join, but I am not getting it quite right:
>
>  person = db(db.person.id==person_id).select(db.person.ALL, db.pet.ALL, 
> db.thing.ALL, 
>                                                                      
> left=[db.person.on(db.person.id==db.pet.person_id),
>                                                                              
> db.person.on(db.person.id==db.thing.person_id)])
>
> I get an error:
>
> OperationalError: ambiguous column name: person.id
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to