sqlite3删除完全重复的数据问题,只留下一条

原文地址:http://bbs.csdn.net/topics/390876793

有一个table,如下:
tbl_person:
id | name | age 
1       a          20
2       b          30
1       a          20
2       b          30
3       c         40
2       b          30
1       a          20
4       d         40
3       c         40
4       d          40
结果要得到
id | name | age 
1       a          20
2       b          30
3       c         40
4       d          40

 

delete from tbl_person where rowid not in(select max(rowid) from tbl_person group by id)

posted @ 2017-12-06 11:25  花影疏帘  阅读(1649)  评论(0)    收藏  举报