0

I have a huge list of roads and the place of that road, like below:

StreetName,PlaceName,xcoord,ycoord
Ovayok Road,Cambridge Bay,-104.99656,69.12876
Ovayok Road,Cambridge Bay,-104.99693,69.12865
Ovayok Road,Cambridge Bay,-104.99794,69.12842
Ovayok Road,Cambridge Bay,-104.99823,69.12835
Hikok Drive,Kugluktuk,-115.09433,67.82674
Hikok Drive,Kugluktuk,-115.09570,67.82686
Hikok Drive,Kugluktuk,-115.09593,67.82689
Hikok Drive,Kugluktuk,-115.09630,67.82695
Sivulliq Avenue,Rankin Inlet,-92.08252,62.81265
Sivulliq Avenue,Rankin Inlet,-92.08276,62.81265
Sivulliq Avenue,Rankin Inlet,-92.08461,62.81262

How to delete rows that have duplicates data on first and second column? All numbers (coordinates) are differents.

John
  • 1
  • 2

1 Answers1

0

If you don't have any column by which you can uniquely identify your data or any column with ID, then fetch the unique records in the table and move them to a copy of the table and rename this temp table with the original table.

Below find the query for the same -

CREATE TABLE street_details_temp LIKE street_details; INSERT INTO street_details_temp SELECT DISTINCT * FROM street_details; DROP TABLE street_details; RENAME TABLE street_details_new TO street_details;