Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so3tP-008145-7d for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 16:39:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1so3tO-00G1cE-8i for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 16:39:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so3tN-00G1c5-Ts for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 16:39:01 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so3tK-000V2F-8P for pgsql-general@postgresql.org; Tue, 10 Sep 2024 16:39:01 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 250562A14D6 for ; Tue, 10 Sep 2024 09:38:57 -0700 (PDT) Date: Tue, 10 Sep 2024 09:38:57 -0700 (PDT) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: Removing duplicate rows in table In-Reply-To: <28d34da0-c58c-4237-b71d-5907517ace45@aklaver.com> Message-ID: <41c47eb5-f6b-8e29-98e6-f6b1fa733bb@appl-ecosys.com> References: <32765388-836c-4c00-bad0-665f0aa77ea8@aklaver.com> <19803246-8b24-5055-ef26-adf7ade3eb@appl-ecosys.com> <28d34da0-c58c-4237-b71d-5907517ace45@aklaver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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; 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.