方法一 普通方法
DELETE
FROM
bookmarks A
WHERE
A.ID NOT IN ( SELECT MIN ( ID ) FROM bookmarks GROUP BY "user_id", "product_id", "is_from_vuclip" );
方法二 速度快
DELETE
FROM
bookmarks A
WHERE
A.ID = ANY (
ARRAY (
SELECT ID
FROM
( SELECT ROW_NUMBER ( ) OVER ( PARTITION BY "user_id", "product_id", "is_from_vuclip" ), ID FROM bookmarks ) T
WHERE
T.ROW_NUMBER > 1
)
);
评论 (0)