id为表中的一个字段,不一定是主键!查询相同的记录的三种方法 1.select * from test t where t.rowid > (select min(x.rowid) from test x where t.id = x.id); 2.select * from test t where t.rowid <> (select max(x.rowid) from test x where t.id = x.id); 3.select count(*),t.id, t.name from test t group by id,name having count(*) > 1;删除重复记录的两种方法: 1.delete from test t where t.rowid > (select min(x.rowid) from test x where t.id = x.id); 2.delete from test t where t.rowid <> (select max(x.rowid) from test x where t.id = x.id);
或者http://www.google.com/search?hl=en&source=hp&q=%E7%94%A8RowID%E6%9F%A5%E6%89%BE%E9%87%8D%E5%A4%8D%E8%AE%B0%E5%BD%95&btnG=Google+Search&aq=f&oq=&aqi=
1.select * from test t where t.rowid > (select min(x.rowid) from test x where t.id = x.id);
2.select * from test t where t.rowid <> (select max(x.rowid) from test x where t.id = x.id);
3.select count(*),t.id, t.name from test t group by id,name having count(*) > 1;删除重复记录的两种方法:
1.delete from test t where t.rowid > (select min(x.rowid) from test x where t.id = x.id);
2.delete from test t where t.rowid <> (select max(x.rowid) from test x where t.id = x.id);