Single Column Multiple Filter In Mysql Intersection

Posted by Jeebus on Stack Overflow See other posts from Stack Overflow or by Jeebus
Published on 2010-04-21T20:00:41Z Indexed on 2010/04/21 20:03 UTC
Read the original article Hit count: 265

Filed under:
|
|

Here is a table

CarID| Attribute    | Value
1   | Color     | Red
2   | Color     | Blue 
3   | Color     | Red 
1   | Type      | Coupe 
2   | Type      | Hatch Back 
3   | Type      | Coupe
3   | Make      | Honda
2   | Make      | Toyota
1   | Make      | Ford

Now I would like to run a filter Like Select * From Cars WHERE (Attribute = Color AND Value = Red) AND (Attribute = Make AND Value = Honda).... and Hope to get the CarID as 3 !

This is simple case of Intersection of 2 queries but I don't know how to get it done in a single query.

Any help appriciated.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about filter