create table 临时表 as
select a.字段1,a.字段2,MAX(a.ROWID) dataid from 正式表 a GROUP BY a.字段1,a.字段2;
delete from 表名 a
where a.rowid !=
(
select b.dataid from 临时表 b
where a.字段1 = b.字段1 and
a.字段2 = b.字段2
);
commit;
create table t_newterminal_log_temp as
select a.USERAGENT,MAX(a.ROWID) dataid from t_newterminal_log a GROUP BY a.USERAGENT;
delete from t_newterminal_log a
where a.rowid !=
(
select b.dataid from t_newterminal_log_temp b
where a.USERAGENT = b.USERAGENT
);
commit;
删除前先备份数据库表:
create table 备份表名 as select * from 原表