delete tab a where rowid<>(select max(rowid) from tab b where a.col1=b.col1 and ...);
如果有主键值就可以定义一行的话就用主键值,不行就把能确定重复情况的列写上就可以了。
或者先创建一个临时表,然后再删除原来的数据再插入就可以了!
create table tab1 as select col1,col2... from tab group by col1,col2...;
truncate table tab;
insert into tab select * from tab1;
drop table tab1;
如果有主键值就可以定义一行的话就用主键值,不行就把能确定重复情况的列写上就可以了。
或者先创建一个临时表,然后再删除原来的数据再插入就可以了!
create table tab1 as select col1,col2... from tab group by col1,col2...;
truncate table tab;
insert into tab select * from tab1;
drop table tab1;
where rowid< (select max(rowid) from table_name
where column1=a.column1 and column2=a.column2
and colum3=a.colum3 and ...);
(select max(rowed) from table t2
where t1.id=t2.id and t1.name=t2.name)