Remove duplicates

DELETE
FROM main_table USING main_table,
    main_table e1
WHERE main_table.id > e1.id
    AND main_table.entity_id = e1.entity_id;

Leave a Reply