I am reading this again. I misunderstood the model. This is not an outer join. This is an inner join. There is no conflict.
Yet I do not understand. You only select db.groups.name and db.city.name. So what you so seem equivalent to this. groups = db(db.city.id == db.groups.city_id).select(db.groups.name, db.city.name) Why join all the other tables? Anyway, try this: rows = (db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.name,db.city.name,db.auth_user.ALL) On Monday, 28 October 2013 18:45:28 UTC-5, Diogo Munaro wrote: > > Yes, thanks Massimo! The first error pass, but now: > > <class 'gluon.contrib.pymysql.err.InternalError'> (1054, u"Unknown column > 'researcher.user_id' in 'on clause'") > > How could I generate sql to debug it? > > > 2013/10/28 Massimo Di Pierro <[email protected] <javascript:>> > >> >> groups = db().select(db.groups.name,db.**city.name <http://db.city.name/> >> ,db.auth_user.email,db.researcher.with_alias('name1').ALL, db.lab. >> with_alias('name2').ALL, >> >> >> join=[db.groups.on(db.groups.**id<http://db.groups.id/> == >> db.lab.group_id), >> db.city.on(db.city.id == >> db.groups.city_id), >> db.auth_user.on(db.researcher.**user_id >> == db.auth_user.id), >> db.researcher.with_alias('name1').on(db.** >> researcher.id <http://db.researcher.id/> == db.researcher_lab_permission. >> **researcher_id), >> db.lab.with_alias('name2').on(db.lab.id == >> db.researcher_lab_permission.**lab_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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

