根据多个字段删除重复数据

DELETE FROM statproductsaleamount WHERE ID NOT IN 
(
  SELECT OneId FROM
    (
        SELECT
        MIN(ID) AS OneId,
        count(*) AS count
        FROM
        statproductsaleamount
        GROUP BY
        ShopName,DateOfData,supercode,pcode,scost
        HAVING
        count(*) >= 1
    ) m
)

 

posted @ 2021-01-28 17:58  星星c#  阅读(167)  评论(0编辑  收藏  举报