Re: Removing duplicate rows in table

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Removing duplicate rows in table
Date: 2024-09-10 16:38:57
Message-ID: 41c47eb5-f6b-8e29-98e6-f6b1fa733bb@appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 10 Sep 2024, Adrian Klaver wrote:

> You might want to do something like:
>
> select proj_nbr, count(*) as ct from projects group by proj_nbr;
>
> to see how big a problem it is. If it is only a few projects it could just a
> matter of manually deleting the extras.

Adrian,

It's a small table, not updated in a while. Looking at the example I sent
how do I delete the extras while keeping one when each row has the same
content? Not knowing how to do that is why I wrote.

> Whatever you do:
> 1) Make sure you have a backup of at least that table.
> 2) Do the data changes as BEGIN; <changes> COMMIT; or ROLLBACK;

Yep. Learned that lesson.

Thanks,

Rich

P.S. Please reply to the mail list so I receive only one copy of your
message, not two.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2024-09-10 16:46:39 Re: Removing duplicate rows in table
Previous Message Francisco Olarte 2024-09-10 16:03:16 Re: Removing duplicate rows in table