【发布时间】:2014-07-31 04:44:21
【问题描述】:
我正在尝试根据任何特定属性找出具有重复值的产品。假设我有一个属性 MPN,并且必须获取共享相同 MPN 的所有产品。我设计了一个部分有效的查询,但我发现它调用的产品很少具有唯一的属性值。
select e.entity_id as ID,n.value as name,e.sku as sku,m.value as mpn from `catalog_product_entity` as e
left join `catalog_product_entity_varchar` as m
on e.entity_id = m.entity_id and m.attribute_id=156
left join `catalog_product_entity_varchar` as n
on e.entity_id = n.entity_id and n.attribute_id=71
group by m.value having count(*)> 1 order by e.entity_id asc
似乎我的逻辑不够公平,无法得到我想要的。
有什么数据库大师可以帮我吗?
【问题讨论】:
标签: mysql database duplicates magento-1.8 product