首页 > 数据库技术 > 详细

sqlite 的去重

时间:2019-10-21 00:49:00      阅读:282      评论:0      收藏:0      [点我收藏+]

1) 找到重复的记录,归类到一个新表里面 max(id) 是想要删除的record

create table ttt as select gallery_url ,max(id) as theid from gallery group by gallery_url having count(*) >=2

 

2) 删除

delete from gallery where id in ( select theid from ttt)

 

sqlite 的去重

原文:https://www.cnblogs.com/johnsonshu/p/11710938.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!