回覆列表
-
1 # 變餅檔
-
2 # 使用者8852944140293
select id,count(1) 重複次數 from A group by id having count(1)>1;
查詢出來的結果都是id重複的,重複次數 中的數值就是重複了多少次。
select id,count(1) 重複次數 from A group by id having count(1)>1;
查詢出來的結果都是id重複的,重複次數 中的數值就是重複了多少次。
1、查詢表中多餘的重複記錄,重複記錄是根據單個欄位(peopleId)來判斷
select * from peoplewhere peopleId in (select peopleId from people group by peopleId having count (peopleId) > 1)
delete from people where peopleId in (select peopleId from people group by peopleId having count (peopleId) > 1)and rowid not in (select min(rowid) from people group by peopleId having count(peopleId )>1)
3、查詢表中多餘的重複記錄(多個欄位)
select * from vitae awhere (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having