did you mean I only need the second query? I know it already extracts data that query one has, but I didn't know how to iterate using only the second one and not redundantly display the parent values.
On Fri, Jun 12, 2015 at 12:06 PM, Niphlod <[email protected]> wrote: > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/PlZM68pN-MU/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

