Du bør være i stand til at lave en korreleret underforespørgsel for at slette dataene. Find alle rækker, der er dubletter, og slet alle undtagen den med det mindste id. For MYSQL skal en indre joinforbindelse (funktionel ækvivalent til EXISTS) bruges, som sådan:
delete games from games inner join
(select min(id) minid, date, time,
hometeam_id, awayteam_id, locationcity, locationstate
from games
group by date, time, hometeam_id,
awayteam_id, locationcity, locationstate
having count(1) > 1) as duplicates
on (duplicates.date = games.date
and duplicates.time = games.time
and duplicates.hometeam_id = games.hometeam_id
and duplicates.awayteam_id = games.awayteam_id
and duplicates.locationcity = games.locationcity
and duplicates.locationstate = games.locationstate
and duplicates.minid <> games.id)
For at teste skal du erstatte delete games from games
med select * from games
. Kør ikke bare en sletning på din DB :-)