The problem is that you select css_selectorproperty and left join css_selectorproperty. Yet you send a condition about the primary table "db.css_selectorproperty.inquery==True" in the codition about the left join. It should be
db(db.css_selectorproperty.inquery==True).select(db.css_selectorproperty.ALL,db.css_declaration.ALL, \ left=db.css_declaration.on((db.css_selectorproperty.id==db.css_declaration.selectorproperty_id)& (db.css_declaration.bedrijf_id==auth.user.bedrijf_id)), orderby=db.css_selectorproperty.id) On Sep 30, 12:11 pm, annet <annet.verm...@gmail.com> wrote: > Massimo, > > > can you > > > print db(...)._select(...) > > > with _select but same query as yours and see what you get? > > This: > > @auth.requires_membership('card') > def manage_css(): > print > db()._select(db.css_selectorproperty.ALL,db.css_declaration.ALL,\ > > left=db.css_declaration.on((db.css_selectorproperty.id==db.css_declaration.selectorproperty_id)& > \ > > (db.css_declaration.bedrijf_id==auth.user.bedrijf_id)&(db.css_selectorproperty.inquery==True)), > \ > orderby=db.css_selectorproperty.id) > > ... results in this: > > SELECT css_selectorproperty.id, css_selectorproperty.selector, > css_selectorproperty.property, css_selectorproperty.name, > css_selectorproperty.inquery, css_declaration.id, > css_declaration.bedrijf_id, css_declaration.selectorproperty_id, > css_declaration.value FROM css_selectorproperty LEFT JOIN > css_declaration ON > ((css_selectorproperty.id=css_declaration.selectorproperty_id AND > css_declaration.bedrijf_id=263) AND css_selectorproperty.inquery='T') > ORDER BY css_selectorproperty.id; > > I think the problem has something to do with the parenthesis in the ON > part of the query, but I am unable to trace it back to the parenthesis > in the function. I hope I provided you with sufficient information to > help me solve the problem. > > Kind regards, > > Annet.