我有一個從CSV文件的copy
創建的臨時表,結果包括一些重複的ID。我需要刪除任何重複。我試過以下內容:刪除重複的記錄,保留一個
delete from my_table where id in
(select id from (select count(*) as count, id
from my_table group by id) as counts where count>1);
但是,這會刪除重複的記錄,我必須保留一個。
如何刪除帶有重複ID的第2條記錄?
謝謝。
這個臨時表只是一個列嗎? DISTINCT將保留他們當然.... –
對不起,不,它是5列。 – pstanton