Duplicate Product checker by SKU in MySQL - Having with Group By

Algorithm


  1. SELECT DISTINCT sku, COUNT(sku) as occur
  2. with Group By
  3. with Having and a condition

Code Examples

#1 Code Example with MySQL

Code - MySQL

SELECT DISTINCT sku, COUNT(sku) as occur 
FROM `items` 
GROUP BY sku 
HAVING occur > 1
Copy The Code & Try With Live Editor

Demonstration


Duplicate Product checker by SKU in MySQL - Having with Group By