Skip to content

Instantly share code, notes, and snippets.

@aalipar13
Created September 25, 2019 07:42
Show Gist options
  • Save aalipar13/dd204010a03c8c3036579fe665ed8405 to your computer and use it in GitHub Desktop.
Save aalipar13/dd204010a03c8c3036579fe665ed8405 to your computer and use it in GitHub Desktop.
SELECT
title, COUNT(title)
FROM
cities
GROUP BY
title
HAVING
COUNT(title) > 1;
DELETE t1 FROM cities t1
INNER JOIN cities t2
WHERE
t1.id < t2.id AND
t1.title = t2.title;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment