Given a table of items, a table of tags and a join table between them, what is a good and efficient way to implement queries of the form:
p1 AND p2 AND ... AND pn AND NOT n1 AND NOT n2 ... AND NOT nk
I am using SQL. So to find all items that match all tags p1...pn and none of n1...nk?
Is there a good "standard" solution for this?