I have a table of places and their regions, but sometimes there is more than one place with the same name in the same region. Real life examples: There are five Springfields in Wisconsin. Nova Scotia, where I live, has three Sandy Coves. I need to find these sorts of records and either disambiguate them (by adding their county or equivalent, for example) or just delete junk/overlapping ones. That will take some work, but first I'd like to see how much work.
PlaceName: RegionName:
Summerville Big State
Summerville Bigger State (OK, different states, no problem...)
Summerville Little State <-
Summerville Little State <- I need to deal with these
This query, based on an answer from another question, gets me all of the places with the same name:
SELECT * FROM Places WHERE PlaceName IN
(SELECT PlaceName FROM Places GROUP BY PlaceName HAVING COUNT(*) > 1);
This is a good start, but I want to skip over the names that don't occur more than once in the same state and just get straight to the problem cases. To put it generically, I'd like to find non-unique records in one column and from there get the ones that are non-unique in another column.
(FWIW, I'm using MariaDB, which is mostly compatible with MySQL.)