Skip to content

Instantly share code, notes, and snippets.

@ckaklamanos
Last active June 2, 2020 12:43
Show Gist options
  • Select an option

  • Save ckaklamanos/c7404a64958afea013b1fd88520b97bc to your computer and use it in GitHub Desktop.

Select an option

Save ckaklamanos/c7404a64958afea013b1fd88520b97bc to your computer and use it in GitHub Desktop.
CS-Cart MySQL find duplicate product codes
SELECT `product_code`, COUNT(*) c FROM [prefix]_products GROUP BY `product_code` HAVING c > 1
#Show product names
SELECT a.product_code,a.status,b.product
FROM xxx_products AS a
LEFT JOIN xxx_product_descriptions AS b
ON a.product_id= b.product_id
WHERE a.product_code
IN (SELECT product_code FROM xxx_products GROUP BY product_code HAVING COUNT(product_code) > 1)
AND a.status='A'
AND b.lang_code='el'
ORDER BY a.product_code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment