I cannot find an answer to this issue.
I want to be able to return a query of Virtuemart (Joomla! + Virtuemart) products that are in more than one category. There are currently 8 categories they could be in (which may grow.)
So a user could potentially select any number of categories and I want back a list of only products that are in ALL selected categories.
How could I do a query that handles this in MySQL?
I don't know your tables structure but this example might give you an idea.
select product
from categories
where category in ('cat1','cat2','cat3')
group by product
having count(distinct(category)) = 3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.