Thanks, I'll give it a try.
On Saturday, May 11, 2013 8:17:58 AM UTC-4, Niphlod wrote:
>
> ok. it adds a layer on top. Basically you want to have all products
> matching all product_filters that have AT LEAST 2 rows for the same product.
>
> here we go.
>
> myfilter = ("top", "sweatshirt")
> top_and_sweatshirts = all_in_one(
> db.filters.name.belongs(myfilter)
> ).select(db.products.id, db.products.name,
> groupby=db.products.id|db.products.name,
> having=db.filters.id.count() >= len(myfilter)
> )
>
>
> so, the logic is.....
> - from the full resultset, filter all that are either "top" or "sweatshirt"
> - group by what I want (products)
> - count it (after grouping), filtering all products.id that have at least
> 2 different filters.id (that means, all products that are BOTH top and
> sweatshirt)
>
> when you "count" after grouping, you have to use the "having" clause....
>
>
>
>
--
---
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/groups/opt_out.