Got this table:
CREATE TABLE `ps_image` (
`id_image` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_product` INT(10) UNSIGNED NOT NULL,
`position` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0',
`cover` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id_image`),
INDEX `image_product` (`id_product`),
INDEX `product_position` (`id_product`, `position`),
INDEX `id_product_cover` (`id_product`, `cover`)
)
I am getting duplicate id_product and need to remove them. What SQL would delete all rows with duplicate id_product from this table but leave one for each id_product?
ALL records have same position and cover values.
What would you suggest for indexes?