![](/style/images/good.png)
4
![](/style/images/bad.png)
请问一下 postgresql 如何删除重复数据项?
source link: https://www.v2ex.com/t/786517
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
大家好,我现在手上有一张大表,600 万的数据吧。但是里面一半是重复的。
column 是这样的
id,column1 ,column2
但是每一项的数据都是重复的,比如
select * from testtable ;
==>
id ,column1,column2
1, name1, 数据 1
1, name1, 数据 22222
因为原先的 id 没有设置唯一约束,导致出现的这么多重复项, id ,column1 内容都是一样的,但是 column2 就不一样了。
怎么样可以保留 column2 字数比较多的那一项,另一项删除掉?
不知道我有没有表述清楚,请大家见谅。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK