I have a mysql table similar to this one where I want to remove duplicates.
CREATE TABLE IF NOT EXISTS `map` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`address` text NOT NULL,
`type` text NOT NULL,
`lat` text NOT NULL,
`lng` text NOT NULL,
PRIMARY KEY (`id`)
);
INSERT INTO `map` (`id`, `name`, `address`, `type`, `lat`, `lng`) VALUES
(607, 'Vostok Station', 'Antarctica', 'establishment', '-82.8627519', '-135'),
(608, 'Vostok Station', 'Antarctica', 'establishment', '-82.8627519', '-135');
I have already tried something like:
SELECT COUNT(address) AS numUsers;
delete from map
where id in
(SELECT MAX(id) FROM TABLE WHERE address IN (SELECT address FROM TABLE
GROUP BY address
HAVING COUNT(*)>1));
Please don't be to harsh to me if I made any faults. I am just a newbie with almost no experience :)