X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 676FF52875 for ; Tue, 24 May 2005 18:26:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86598-05 for ; Tue, 24 May 2005 21:26:03 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 6BCF352894 for ; Tue, 24 May 2005 18:26:01 -0300 (ADT) Received: (qmail 11825 invoked from network); 24 May 2005 23:26:36 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 24 May 2005 23:26:36 +0200 Date: Tue, 24 May 2005 23:26:04 +0200 To: lucas@presserv.org, pgsql-sql@postgresql.org Subject: Re: Duplicated records References: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org> From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/210 X-Sequence-Number: 21523 > How can I delete the duplicated records with "DELETE FROM TABLE WHERE..." > clause?? > The problem is becouse I have imported data from Dbase (dbf) file, and > this > function have not built the Constraint (unique, primary key, ...), and > this > function is usually executed. If you have no primary key how can you reference a record in order to delete it ? I'd say use a temporary table... If you have complete row dupes (ie. the entire row is duplicated) use SELECT * FROM table GROUP BY * (or select distinct) If only the primary key is duplicated but other fields change, then you have to decide which one you wanna keep !