Doppelte Einträge per SQL herausfinden

SELECT *
FROM table
WHERE `nubmer` IN (
    SELECT `number`
    FROM table
    GROUP BY `number`
    HAVING count(number) > 1
    )
ORDER BY `number`

Ein anderes Beispiel:

DELETE FROM users
WHERE id NOT IN (
  SELECT * FROM (
    SELECT MIN(id)
    FROM users
    GROUP BY email
  ) as t);

Beispiel für die Magento SKU:

SELECT *
FROM catalog_product_entity
WHERE `sku` IN (
    SELECT `sku`
    FROM catalog_product_entity
    GROUP BY `sku`
    HAVING count(sku) > 1
    )
ORDER BY `sku`
Keine Kommentare

Sorry, the comment form is closed at this time.