找重复按最大int_id删除重复

update rms_cell
set stateflag=to_char(sysdate,'yyyymmddhh24miss')
where int_id in(
select max(int_id)
from rms_cell where MCC||'-'||MNC||'-'||LAC||'-'||CI
in (
select MCC||'-'||MNC||'-'||LAC||'-'||CI
from RMS_CELL
where STATEFLAG=0
group by MCC||'-'||MNC||'-'||LAC||'-'||CI
having count(MCC||'-'||MNC||'-'||LAC||'-'||CI)>1
)
group by MCC||'-'||MNC||'-'||LAC||'-'||CI
)



你可能感兴趣的:(sql)