Looking to find all duplicate product names,
Tried to find out with group by but it not giving duplicate values,its eliminate duplicates values,
$collection = $this->productFactory->create()->getCollection();
$collection->getSelect()
->reset(\Zend_Db_Select::COLUMNS)
->columns(['entity_id'])
->columns(['sku']);
$collection->addAttributeToSelect(['sku', 'name', 'url_key', 'meta_description'], 'left');
$collection->getSelect()->group('name');
$collection->getSelect()->having('count(name) > ?', 1);
Looking result is as follows,
Sku,name
1,abc
2,abc
Any help appriciated,
Thanks & Regards,