读书人

请问SQLITE怎么删除表内重复的记录

发布时间: 2012-02-07 17:45:36 作者: rapoo

【求助】请教SQLITE如何删除表内重复的记录
表如下
SID TIT
10001 hello1
10002 hello2
10002 hello3
10003 hello4

执行后的效果

SID TIT
10001 hello1
10002 hello2
10003 hello4

SQLSERVER的代码用不上,

请教各位前辈 SQLITE代码要怎么写?

[解决办法]

SQL code
sqlite> select * from Yookey;sid|tit10001|hello110002|hello210002|hello310003|hello4sqlite>sqlite> delete from Yookey where tit not in (select min(tit) from Yookey group by SID);sqlite> select * from Yookey;sid|tit10001|hello110002|hello210003|hello4sqlite> 

读书人网 >其他数据库

热点推荐