mysql select help

Posted by user344766 on Stack Overflow See other posts from Stack Overflow or by user344766
Published on 2010-05-19T06:15:05Z Indexed on 2010/05/19 6:20 UTC
Read the original article Hit count: 124

Filed under:

Hi I have a table that looks like this

id : productid : featureid and would have the following data: (1, 1, 16)
(2, 1, 21)
(3, 1, 25)
(4, 2, 16)
(5, 2, 21)
(6, 2, 27)

where featureid is a foreign key to another table.

I need to select products that have both featureids of 16 and 25, in which case productid 1 but not productid 2

Can someone show me an example of how to format this query.

© Stack Overflow or respective owner

Related posts about mysql-query