I have a sql query. The Where clause is a little tricky, because I need it to tell that fv.position should be greater than a number and id_feature a specific number, but only in that state. So there could be multiple where stack's like that.
This is what I have come up with so far:
SELECT
*
FROM
psx_product p
INNER JOIN
psx_feature_product fp ON fp.id_product = p.id_product
INNER JOIN
psx_feature_value fv ON fp.`id_feature_value` = fv.`id_feature_value`
WHERE
(fv.position > 0 AND fp.id_feature = 6)
AND
(fv.position > 5 AND fp.id_feature = 7)
AND
(fv.position > 2 AND fp.id_feature = 8)
But I believe that the above example is the wrong way of handling it, because fv.position doesen't know that it's connected to only the feature in the perentesis, and stacking the where statements, just give empty result, where, one gives results. How should this be done right?