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 1so2SU-007pyA-40 for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:07:11 +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 1so2ST-00EObY-Rd for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:07:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so2ST-00EOZB-EA for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 15:07:09 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so2SP-000TwS-S0 for pgsql-general@postgresql.org; Tue, 10 Sep 2024 15:07:08 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 4506E2A14D6 for ; Tue, 10 Sep 2024 08:07:04 -0700 (PDT) Date: Tue, 10 Sep 2024 08:07:04 -0700 (PDT) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@postgresql.org Subject: Removing duplicate rows in table Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I've no idea how I entered multiple, identical rows in a table but I want to delete all but one of these rows. Here's an example: bustrac=# select * from projects where proj_nbr = '4242.01'; proj_nbr | proj_name | start_date | end_date | description | notes ----------+----------------+------------+------------+---------------+------- 4242.01 | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy | 4242.01 | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy | 4242.01 | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy | 4242.01 | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy | (4 rows) How do I clean this up so there's only a single row for this project number? TIA, Rich