TEL:150-0382-3679
新闻资讯 News Center
建站知识 / 公司动态
按指定字段去重res_id ,executor,保留最早的一条记录ORDER BY id
WITH cte AS (
    SELECT 
        id,
        ROW_NUMBER() OVER (
            PARTITION BY res_id ,executor
            ORDER BY id  -- 按ID升序,保留最小ID
        ) AS rn
    FROM plan_task
    where year=2026 and state in(0,3,6)  and res_type =102007
 and delete_state =false 
)
update plan_task set delete_state=true ,remark='260119发现有重复的'
WHERE id IN (SELECT id FROM cte WHERE rn > 1);
一站式全网营销,您身边的网络营销顾问,为您一对一私人定制符合您实际需求的网络营销实施方案!
24小时咨询热线:
150-0382-3679