create table test(id int, name varchar);
insert into test values(1,'a'),(1,'a'),(2,'b');
  • 查询
select * from test;

结果:
postgresql去除重复行

select ctid,* from test;

结果:
postgresql去除重复行

  • 去除重复行
delete from test where ctid not in (select min(ctid) from test group by id);
  • 验证
select ctid,* from test;

postgresql去除重复行

相关文章:

  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-09
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
相关资源
相似解决方案