How do I search for all products of a certain combination of filters in a 
many to many relationship? The products returned have to at least have the 
filters given.

For example, if I had this many to many relationship:

db.define_table('thefilter_products',
         Field('product', db.products),
         Field('thefilter', db.thefilter))

And say we have:
"Product1": "Tops", "Sweatshirts"
"Product2": "Tops", "Sweatshirts", "Hoodie"
"Product3": "Tops", "AthleticWear"

And I wanted to get all products that at least contain the filters "Tops" 
and "Sweatshirts", what would be the db().select() query to do this? The 
desired result would return only "Product1" and "Product2".

I tried using belongs, but that returned all products that included any of 
the filter terms. I've also tried using the & on both the "Tops" and 
"Sweatshirts" filter id ( db.thefilter_products==thefilter.id ), but this 
returned an empty Set.

-- 

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