0
我有一個表有兩個colums,id和日期。這裏是相同的樣本數據。刪除oracle中的重複記錄
ID DATE
1 01-Jan -14 05.42.23.000000000 pm
1 01-Jan -14 05.06.17.000000000 pm
2 01-Jan -14 05.26.16.000000000 pm
2 01-Jan -14 05.41.20.000000000 pm
3 01-Jan -14 05.21.19.000000000 pm
3 01-Jan -14 05.08.18.000000000 pm
4 01-Jan -14 05.14.17.000000000 pm
4 01-Jan -14 05.17.17.000000000 pm
列ID
有哪些需要刪除,我想保持這行列DATE
較大的重複數據。
我編寫SQL,但結果不正確。
delete from newproducts a
where a.id in
(select t.id from newproducts t group by t.id having count(*) > 1)
and a.date not in
(select max(t.date) from newproducts t group by t.id having count(*) > 1);
如何更正?謝謝
Noooooooo!不是另外刪除重複的問題!我們如何刪除重複的「刪除重複」問題? – tbone