ムーサ:
郵便番号:
このために存在していない場所を使用します。
これは、以下削除するリストを与えます
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_image
where id in
(
select id from
(
select id
from product_image a
where exists
(
select 1 from product_image b
where a.product_id = b.product_id and a.id < b.id
)
)a
)