db(db.city.name.contains('rio') & db.city.state_id == db.state.id).select(db.city.name,db.city.id,db.state.name)
It's normal?Looking inside, I saw that web2py is making a WHERE clause instead of a JOIN.
But the book is wrong?
Here: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=join#Inner-joins
There is an alternative syntax for INNER JOINS:
>>> rows = db(db.person).select(join=db.thing.on(db.person.id==db.thing.owner_id))
>>> for row in rows:
print row.person.name, 'has', row.thing.name
Alex has Boat
Alex has Chair
Bob has ShoesWhile the output is the same, the generated SQL in the two cases can be different.
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/EW_WhDeP9Uo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.