As described here:
http://web2py.com/book/default/chapter/06#Left-Outer-Join

db(inner_joins).select(select_fields, left = db.tablename.on(...))

note that "left" can be a list of joins if you need >1 left join in query.

left = [db.table1.on(...), db.table2.on(...), ...]

On Mon, Oct 31, 2011 at 5:02 PM, Philip Kilner <phil.kil...@gmail.com>wrote:

> Hi,
>
> I've a query as follows: -
>
> elements_pending = db(db.client_delegate.id==**request.args(1))\
> (db.client_delegate.client_**role_id==db.client_role.id)\
> (db.role_element.client_role_**id==db.client_delegate.client_**role_id)\
> (db.client_delegate_**assessment.role_element_id==db**.role_element.id<http://db.role_element.id>
> ).select()
>
> ...but which i need to make a left out join, such that
> "client_delegate_assessment" will be shown if present, but I'm having
> problems figuring out how to change the code above.
>
> I've used "executesql" for now, but I'd like to get my head around this
> because it's making me feel silly!
>
>
> --
>
> Regards,
>
> PhilK
>
>
> 'a bell is a cup...until it is struck'
>
>

Reply via email to