select max(id) from table group by col1,col2,col3... ) group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同2.没有ID字段,用rowid delete from table where rowid in (select a.rowid from table a, table b where a.rowid>b.rowid and a.col1=b.col1 and a.col2 = b.col2 and ...)
delete table where rowid not in (select max(rowid) from table group by col1,col2,...,coln);
delete tb a where a.rowid > (select min(b.rowid) from tb b where b.xx = a.xx)
delete 表名 where rowid not in (select max(rowid) from 表名 group by 列名);(注这里的列名就是你根据那个列判断重复的,可以为多列)
delete from table where rowid in (select a.rowid from table a, table b where a.rowid>b.rowid and a.col1=b.col1 and a.col2 = b.col2 and ...)
使用rowid时最后的解决办法,表中每行记录的rowid都是唯一的 delete from table_A a where a.rowid < (select max(b.rowid) from table_A b where a.column1 = b.column1 and a.column2 = b.column2 ... --有多少列就写多少列,方法同上 );
delect table where id not in (
select max(id) from table group by col1,col2,col3...
)
group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同2.没有ID字段,用rowid
delete from table where rowid in (select a.rowid from table a, table b
where a.rowid>b.rowid and a.col1=b.col1 and a.col2 = b.col2 and ...)
where a.rowid > (select min(b.rowid)
from tb b
where b.xx = a.xx)
where a.rowid>b.rowid and a.col1=b.col1 and a.col2 = b.col2 and ...)
delete from table_A a
where a.rowid < (select max(b.rowid)
from table_A b
where a.column1 = b.column1
and a.column2 = b.column2
... --有多少列就写多少列,方法同上
);