(一)最原始的方法:
delete from test where id not in (select * from ((select min(id) from test group by(name)) as tmptable));删除重复,留下id最小的数据
delete from test where id not in (select * from ((select max(id) from test group by(name)) as tmptable));删除重复,留下id最大的数据
测试一下:
delete from log_visit_20131210 where id not in (SELECT * from ((select min(id) from log_visit_20131210 group by domain,url,c_date,c_ip) as tmptable))
感觉200万的数据有点难啃。
(二)推荐使用spoon 中的去除重复功能,效果还不错