我有在 Product_Attributes 表上连接 Products 表的查询。我想获得肉类确切状况的产品。
选择了属性 id 9 和 16 的产品,但是当我运行此查询时,我只会得到满足第一个 ID 的产品
WHERE ("AttributeValueID" = 9 AND "AttributeValueID" = 16)
我需要该产品同时选择这两个属性AttributeValueID = 9 AND AttributeValueID = 9 not only this or that attribute ID.使用OR / IN对我来说不是解决方案。
更新:
以下是使用 join / where 查询的一部分:
LEFT JOIN "Product_Attributes" ON "Product_Attributes"."ProductID" = "SiteTree_Live"."ID" WHERE ("PriceTax" >= '100' AND "PriceTax" <= '200') AND ("AttributeValueID" IN ('9 ','8','7')) AND ("AttributeValueID" IN ('5','4'))
预先感谢您的帮助