But the book is wrong?
Here: 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=join#Inner-joins

Em terça-feira, 22 de outubro de 2013 13h09min07s UTC-2, Anthony escreveu:
>
> db(db.city.name.contains('rio') & db.city.state_id == db.state.id).select(
>> db.city.name,db.city.id,db.state.name)
>
>
> db(db.city.name.contains('rio') & db.city.state_id == db.state.id)
>
> should be:
>
> db(db.city.name.contains('rio') & (db.city.state_id == db.state.id))
>
> In python, the & takes precedence over the == (see 
> http://docs.python.org/2/reference/expressions.html#operator-precedence), 
> so you need to put the second part of the query in parentheses.
>  
>
>> Looking inside, I saw that web2py is making a WHERE clause instead of a 
>> JOIN.
>>
>> It's normal?
>>
>
> Yes, if you do an implicit join via the query, web2py generates a WHERE 
> clause, not an explicit JOIN statement.
>
> Anthony
>

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