is it better to issue two separate queries returning a set with 2 records 
and 10 respectively or to fetch a joined set (and massage it later on) that 
extracts 20 records ? There's no answer to that except that the two 
possibilities are entirely doable. Cardinality of the sets comes into play, 
plus the number of columns on either tables. In one word, there's no silver 
bullet.

The problem is, the "sane options" are either:

a) distinct sets
q = db.parent_record.style == 'yellow'
parents = db(q).select()
childs = 
db(db.child_record.parent_id.belongs(db(q)._select(db.parent_record.id))).select()

b) joined set

parent_and_childs = db((db.parent_record.style=='yellow') & 
(db.parent_record.id == db.child_record.parent_id)).select() 

what you do instead is fetching the parents AND then the joined set....... 
your second query extracts all the info already

-- 
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/d/optout.

Reply via email to