刪除表中重複記錄,只保留一條:spa
delete from 表名 where 字段ID in (select * from (select max(字段ID) from 表名 group by 重複的字段 having count(重複的字段) > 1) as b);it
查詢重複數據
select * from prpmlossitem where CaseNo in (
select CaseNo from prpmlossitem
group by CaseNo
having count(CaseNo) > 1
) select