Yeah sure - here is the exact query
Code:
CREATE TABLE towns_to_delete SELECT towns.town_id
FROM (
SELECT MIN( town_id ) AS min_id, town, county
FROM towns
GROUP
BY town, county
HAVING COUNT( * ) >1
) AS dupes
INNER
JOIN towns ON towns.town = dupes.town
AND towns.county = dupes.county
WHERE towns.town_id > dupes.min_id
I tried the following from post 8 again and it still works. I guess you know it is not exactly the same query
Code:
SELECT MIN( town_id ) , town, county
FROM towns
GROUP
BY town, county
HAVING COUNT( * ) >1
LIMIT 0 , 30
Bookmarks