DELETE
FROM
jk_his_zybrcryxxb a
WHERE
(a.brid, a.zycs,a.ryrq) IN (
select * FROM
(
SELECT
brid,
zycs,ryrq
FROM
jk_his_zybrcryxxb
GROUP BY
brid,zycs,ryrq
HAVING
count(*) > 1
) c
)
AND a.id NOT IN (
select * FROM
(
SELECT
max(id)
FROM
jk_his_zybrcryxxb
GROUP BY
brid,zycs,ryrq
HAVING
count(*) > 1
) d
)
原创文章,作者:506227337,如若转载,请注明出处:https://blog.ytso.com/274523.html