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 A4D3432A923 for ; Thu, 21 Oct 2004 20:21:03 +0100 (BST) 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 34501-01 for ; Thu, 21 Oct 2004 19:20:47 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 261F532A8DF for ; Thu, 21 Oct 2004 20:20:47 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i9LJKjJ7034619 for ; Thu, 21 Oct 2004 19:20:45 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i9LJKfuQ034603 for pgsql-sql@postgresql.org; Thu, 21 Oct 2004 19:20:41 GMT From: Bricklen User-Agent: Mozilla Thunderbird 0.8 (X11/20040926) X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Finding duplicated values References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lines: 28 Message-ID: Date: Thu, 21 Oct 2004 19:20:42 GMT To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200410/176 X-Sequence-Number: 19279 Kent Anderson wrote: > I have a few tables that have duplicated values from an import from a > different database. I have two keys I tried to set as primary and got an > error > ERROR: could not create unique index > DETAIL: Table contains duplicated values. > > Is there some join I can use to compare the hmhmkey, wmwmkey pairs > against the table to find duplicate values? Each pair key should be > unique but the old database was less than normalized. > > I was trying to use the code below but it returned no rows. > > SELECT hmhmkey, wmwmkey > FROM exceptions > EXCEPT > SELECT hmhmkey, wmwmkey > FROM exceptions; > > Any suggestions? > > Kent Anderson > EZYield.com > 407-629-0900 > www.ezyield.com Try http://archives.postgresql.org/pgsql-sql/1999-03/msg00239.php