I'm trying to query the following table:
+----+------------------+----------------+-------------+-------+
| id | describable_type | describable_id | property_id | value |
+----+------------------+----------------+-------------+-------+
| 1 | product | 1 | 6 | Red |
| 2 | product | 2 | 6 | Blue |
| 3 | product | 1 | 4 | 150 |
| 4 | product | 2 | 4 | 150 |
+----+------------------+----------------+-------------+-------+
I want all describable_id
where the value of property_id 6 is Red
and property_id 4 is 150
.
I just cannot figure out how to query this.
id
column. Get rid of it and provide a suitable compositePRIMARY KEY
. See mysql.rjweb.org/doc.php/… and mysql.rjweb.org/doc.php/eav