используйте, где не существует для этого:
Ниже приведен список для удаления
select *
from product_image a
where exists
(
select 1 from product_image b
where a.product_id = b.product_id and a.id < b.id
)
Ниже приведены все, кроме первого, для каждого product_id
Delete From product_images
where id not in
(
select id from
(
select id
from product_images a
where not exists
(
select 1 from product_images b
where a.product_id = b.product_id and a.id > b.id
)
)a
)
Fiddle