获取以magento购买这些产品的用户

时间:2016-09-23 13:25:00

标签: php mysql magento

我参考示例Get users who have bought these products in magento,但我希望有多个产品的多个条件。

假设我有ID为1,2,3,4,5等的产品清单......我想获得购买这些产品的所有客户的清单。

我有一个管理界面,如购物车规则条件 AND / OR

我的情况如下:

例如:

  • WHERE(product_id = 1 AND product_id = 2 AND product_id = 3 AND product_id = 4)
  • WHERE(product_id = 1 OR product_id = 2 AND product_id = 3 OR product_id = 4)
  • WHERE(product_id = 1 AND product_id = 2 OR product_id = 3 AND product_id = 4)

但我可以通过WHERE product_id = 1 OR product_id = 2 OR product_id = 3 获取所有客户的电子邮件ID列表 product_id = 4。

该查询是:

SELECT DISTINCT o.customer_email FROM sales_order_item i INNER JOIN sales_order o ON o.entity_id = i.order_id WHERE((i.product_id = 1)OR(i.product_id = 2)OR(i.product_id = 3 ))GROUP BY o.customer_email

请建议是否有人有此类解决方案.....

0 个答案:

没有答案