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 1so2hb-007rWh-2X for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:22:48 +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 1so2ha-00Elpu-KW for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:22:46 +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 1so2hZ-00Elpl-Qj for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 15:22:46 +0000 Received: from fhigh3-smtp.messagingengine.com ([103.168.172.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so2hR-000UP4-LC for pgsql-general@postgresql.org; Tue, 10 Sep 2024 15:22:45 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id 6DB51114015B; Tue, 10 Sep 2024 11:22:37 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Tue, 10 Sep 2024 11:22:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1725981757; x=1726068157; bh=uVite4c8KbIC86q8YKPWXiLZ68J8M7dAYfwFe6t0/qs=; b= VquaTmgGxR8dAy5pWQsLspRy34ls/hYde7T5ASabdIucyAx5q09nSt30Iy6q+w9n tzDcfuMv04nu+EpkVInrW53uLQQafDDBk5uX+hl5PT4MGflr/C6Kc/usnuWRkQHC eE7RfJ8JpJ4jKuXwlEI6AZHGy791nWFt0GXbn5uBkZ2QtLcOBx9jBVNeTfJ9JJYb lbBaR7UNo83ENG9Hn7NNLL5r18y5y1R0taTCywnMhEOxBywhKfKvlA3ROt1ao6WB PwtOYUheQsAQGKm3tHQQMMpdyNuX232ejvuM3fgjHL/peknGzjV7WGkP/zPZ8oMx QlHdD2ZBPAdWFfJGVegTvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1725981757; x= 1726068157; bh=uVite4c8KbIC86q8YKPWXiLZ68J8M7dAYfwFe6t0/qs=; b=S R5kmLfET4iDiAyxPUFCGAxecRxNbHVFcFRioXw08r/WEjJUq2iBwdJ8XPYgSv7Ti BwJHD3y/ZZWupimetMWktzY3ZHQDHvrYRFZLz6gNIzzOJBKBryg0MB8f0Pbg6v6w JpDHkQ86BvS0CaP2hOSAkiZ198oQLG/zqEi64rctYwjgWFtdd1oNbJOf7DkXT3I+ T1Jw6GL4x44/6cPqmA/UihdgOHX8+DpUZPS/TKlAKgJXIp7I2bBbbqKQnkYLbhFP HjcR2WK9hBb/rzRtYJwk4RGXdS8wCxiJYMknFJwokUO+3sCwysMyGf2TfixkbtVe ftEivxL3Ev2IoQd9ZP06Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeiledgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeen ucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeffleegieefgfevudehtdfh keeutdffjeevgeffgeejvedthefgudeiteefheejheenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhl rghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehrshhhvghprghrugesrghpphhlqdgvtghoshihshdrtghomhdprhgtphht thhopehpghhsqhhlqdhgvghnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 10 Sep 2024 11:22:36 -0400 (EDT) Message-ID: <32765388-836c-4c00-bad0-665f0aa77ea8@aklaver.com> Date: Tue, 10 Sep 2024 08:22:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Removing duplicate rows in table To: Rich Shepard , pgsql-general@postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/10/24 08:07, Rich Shepard wrote: > I've no idea how I entered multiple, identical rows in a table but I > want to > delete all but one of these rows. Is there a Primary Key or Unique index on this table? > > 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 > > -- Adrian Klaver adrian.klaver@aklaver.com