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
);
QUERY: Remove duplicate values Print
Modified on: Mon, 9 Apr, 2018 at 3:28 PM
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.