I have three tables:
project (idproject, name)
color (idcolor, name)
project_has_color (idproject, idcolor)
Now I need to select projects connected with set of colors, for example: blue (1), red (2), green (3):
SELECT p.idproject, p.name
FROM project p, project_has_color c
WHERE p.idproject=c.idproject AND c.idcolor IN (1,2,3)
gives me projects connected with one or more given idcolor, and I need projects connected with all of them - but I can't figure out how to achieve this?