方法有很多,这里记录一下,使用子查询的方式。
UPDATE t_plm_contract_bill_term_monitor set is_deleted=1, gmt_modify=now() where id in( select id from ( select min(id) as id from t_plm_contract_bill_term_monitor where is_deleted=0 and bill_term_start_date = '2020-02-01' group by bill_term_start_date,contract_id having count(*)>1) as tmp ) ;
但是,在执行的时候,发现速度不是很快。