您好,欢迎访问一九零五行业门户网

删除表中重复记录大于两条保存两条

delete from t_cht_clm_reg f where f.case_id in ( select t.case_id from ( select b.* from (select e.* , row_number() over (partition by e.notice_id order by e.case_id desc) rn from t_cht_clm_reg e) b where b.notice_id in( select a.notice_id
delete from t_cht_clm_reg f where f.case_id in (
select t.case_id from (
select b.* from (select e.* , row_number() over (partition by e.notice_id order by e.case_id desc) rn
from t_cht_clm_reg e) b where b.notice_id in(
select a.notice_id from (select e.* , row_number() over (partition by e.notice_id order by e.case_id desc) rn
from t_cht_clm_reg e) a group by a.notice_id having count(a.notice_id) > 2 )
) t where t.rn > 2 )
delete from t_cht_clm_reg f where f.case_id in (select t.case_id from (select b.* from (select e.* , row_number() over (partition by e.notice_id order by e.case_id desc) rn from t_cht_clm_reg e) b where b.notice_id in(select a.notice_id from (select e.* , row_number() over (partition by e.notice_id order by e.case_id desc) rn from t_cht_clm_reg e) a group by a.notice_id having count(a.notice_id) > 2 ) ) t where t.rn > 2 )
其它类似信息

推荐信息