--查找表中多余的重復記錄
select * from code_xz where code in
(select code from code_xz group by code having count(1)>1)
--刪除表中多余的重復記錄,只留有pk_uid最小的記錄
delete from code_xz where code in
(select code from code_xz group by code having count(code) > 1)
and pk_uid not in (select min(pk_uid) from code_xz group by code having count(code)>1)