This is a example of a self join in SQL to find duplicate values and remove them. The first statement will select the duplicate items and the second will remove them.

The table is d_mapsheet_hp1 and the column is called tilename.

SELECT tilename FROM
d_mapsheet_hp1 A
WHERE rowid >
(SELECT min(rowid) FROM d_mapsheet_hp1 B
WHERE
B.tilename = A.tilename
);



DELETE FROM d_mapsheet_hp1 A
WHERE A.rowid >
ANY (SELECT B.rowid
FROM
d_mapsheet_hp1 B
WHERE
A.tilename = B.tilename
);