日期:2014-05-17  浏览次数:20692 次

删除除重复的数据,并保留一行
表A

ID      mobile

1       15195986888
2       15195986888
3       15195986888
4       13776667680
5       13776667680
6       13776667680
7       18196999999

现在要删除里面的重复数据 并保留一行
结果如下
1       15195986888
2       13776667680
3       18196999999


------解决方案--------------------
delete from a where rowid not in (select max(rowid) from a group by mobile);

------解决方案--------------------
对,就是用max或min
------解决方案--------------------
看你要干啥,建议你建一个临时表插进去

insert into XXXX
SELECT max(id),mobile from A
group by mobile;
commit;

方便回溯。