SQL语句如下:
DELETE FROM T_S_POS_SHOPRECODE A
WHERE (A.POSID, A.SHOPTIME, A.CARDID) IN
(
SELECT POSID, SHOPTIME, CARDID
FROM T_S_POS_SHOPRECODE
GROUP BY POSID, SHOPTIME, CARDID
HAVING COUNT(*) > 1
)
AND
ID NOT IN
(
SELECT MIN(ID) FROM T_S_POS_SHOPRECODE
GROUP BY POSID, SHOPTIME, CARDID
HAVING COUNT(*) > 1
);
最新评论