select SERVICE_ID,STANDARD_YEAR,count(*)
from DZBLPJ.INSURANCE_SERVER_ITEM group by SERVICE_ID,STANDARD_YEAR
delete from DZBLPJ.INSURANCE_SERVER_ITEM a
where (SERVICE_ID,STANDARD_YEAR) in (select SERVICE_ID,STANDARD_YEAR
from DZBLPJ.INSURANCE_SERVER_ITEM group by SERVICE_ID,STANDARD_YEAR having count(*) > 1)
and rowid not in (select min(rowid) from DZBLPJ.INSURANCE_SERVER_ITEM
group by SERVICE_ID,STANDARD_YEAR having count(*)>1)
DELETE
FROM
LCFYJTTZ c
WHERE
EXISTS (
SELECT
a.ROWID
FROM
LCFYJTTZ a,
(
SELECT
fdate,
ffjdm,
flcdm,
ffytype,
fgsbz,
MIN( ROWID ) rid
FROM
lcfyjttz
GROUP BY
fdate,
ffjdm,
flcdm,
ffytype,
fgsbz
HAVING
count( 1 ) > 1
) b
WHERE
a.FDATE = b.FDATE
AND a.FFJDM = b.FFJDM
AND a.FLCDM = b.FLCDM
AND a.ffytype = b.FFYTYPE
AND a.ROWID != b.rid
AND c.ROWID = a.ROWID
)