I need help designing a query that will be used to return a website's search results. Users search by selecting items from a list of attributes. Each search result item returned must have ALL the attributes selected by the user.
The challenge (for me at least!) is figuring out how to only return results that have ALL the attributes versus just ANY of them.
The search result items (let's call them WIDGETs) are in the WIDGET table. Possible widget attributes are in the ATTRIBUTE table. A junction table (WIDGETATTRIBUTEJUNCTION) stores the 0,1..n actual attributes for each WIDGET.
I can't figure out a query that, when supplied a list of widget attributes, will return rows that have every one of these attributes. I suspect I might use an ALL subquery and/or an INTERSECT but not sure how.