can you move that *AND user_id = 3* in the where condition ?

On Thursday, April 11, 2013 5:19:15 PM UTC+2, Fabiano Faver wrote:
>
>
> niphlod I'm having a problem with left with AND.
>
> this is the sql I want to work:
> SELECT * 
> FROM permissao_grupo
> LEFT JOIN auth_membership ON auth_membership.id_permissao_grupo = 
> permissao_grupo.id
> AND user_id =3
> WHERE permissao_grupo.id_grupo =5
> this is what i tried until now:
> db((db.permissao_grupo.id_grupo==grupo)&(db.tipo_documento.id
> ==db.permissao_grupo.id_tipo_documento))._select(left=((db.auth_membership.on(
> db.permissao_grupo.id
> ==db.auth_membership.id_permissao_grupo))&(db.auth_membership.user_id==usuario)))
>
> but i got this error:
> <type 'exceptions.TypeError'>(unsupported operand type(s) for &: 
> 'Expression' and 'Query')
>
> What I need to do?
>
> Em quinta-feira, 11 de abril de 2013 11h39min25s UTC-3, Niphlod escreveu:
>>
>> the whole point of left= is to trigger a LEFT OUTER JOIN that by design 
>> reports ALL the elements of the left table and only the elements that 
>> matches of the right table....
>> If you don't want this functionality then left= is not good for your 
>> usecase
>>
>> On Thursday, April 11, 2013 4:23:12 PM UTC+2, Annet wrote:
>>>
>>> I have the following code:
>>>
>>>
>>> rows=db(db.node.computedSubClass!=SC_CONSUMER).select(db.node.ALL,db.groups.ALL,left=db.groups.on((
>>> db.node.id==db.groups.nodeID)&(db.groups.type!=RELATEDNAMES)))
>>>
>>> I'd hoped that this would exclude groups of type RELATEDNAMES of rows, 
>>> however, the code sets all fields of db.groups.ALL to None and includes 
>>> them in rows.
>>>
>>> How do I get rows without groups of type RELATEDNAMES using a left join.
>>>
>>>
>>> Kind regards,
>>>
>>> Annet
>>>
>>

-- 

--- 
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