I have a database with all the cities in the world.
and if I run this query I can see there are doubles:
I already used this query to delete all duplicate rows:
WITH CTE AS
(
SELECT *,ROW_NUMBER()
OVER (PARTITION BY Country, City, AccentCity, Region, Population, latitude, Longitude
ORDER BY Country, City, AccentCity, Region, Population, latitude, Longitude) AS RN
FROM ExperimentWorld
)
DELETE FROM CTE WHERE RN<>1
I would now run it again and delete all columns where latitude and Longitude are the same and if two rows are the same like in the picture above I want to keep the one where population has some value and delete the one with population '0'
