postgres重复数据只保留1条数据

delete from t_openapi_baseindex_week where ctid not in (select max(ctid) from t_openapi_baseindex_week group by 
    area_code,
    area_name,
    YEAR,
    week,
    TYPE,
    time_type,
    is_workday having count(*) >1);
 

    原文作者:pigs2018
    原文地址: https://blog.csdn.net/ZHANGHUI3239619/article/details/107759968
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞