I have a parent (Relationship) table and a child (Role) table.

Some of the child (Role) records contain the value "DMV", and other child 
(Role) records contain the value "Suggestion".

I want to find a parent (Relationship) table that has Role children that 
contain both of the above values. In other words, Relationship has both a 
child that has "DMV", and another child that has the value "Suggestion". 

The problem is that I can't use the "or" operator because both children 
have to exist with the same parent.  I can't use the "&" operator because 
the values are mutually exclusive in the same child record.

To re-describe the question, here is an example of how it might be solved 
using pseudo code.

FirstPass=db(Relation.id == Role.relationId) & (Role.value=="DMV")
SecondPass=db(Relation.id == Role.relationId) & (Role.value=="Suggestion")
ThirdPass=(FirstPass.relationId==SecondPass.relationID)

Now in ThirdPass I have only the Relation records that have both "DMV" and 
"Suggestion" Role children.

Thanks,

Alex Glaros

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

Reply via email to