数据库(记录),该如何解决

数据库(记录)一个表中有若干相同的记录,用SQL语句怎么删除重复记录,只保留唯一一条呢?[解决办法]方法一先

数据库(记录)
一个表中有若干相同的记录,用SQL语句怎么删除重复记录,只保留唯一一条呢?

[解决办法]
方法一
先备份表,删除了重新插于
create table test as (select distinct * from test1)


truncate table test


insert into test select * from test1;

drop table test1

方法二
delete from test where rowid not in (select max(t1.rowid) from test1 t1 group by id,city,num)

[解决办法]
delete from tab a where a.rowid not in (select max(rowid) from tab b where a.id=b.id)