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 C43E132A936 for ; Thu, 21 Oct 2004 19:59:13 +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 26878-01 for ; Thu, 21 Oct 2004 18:59:10 +0000 (GMT) Received: from ezyield.com (unknown [209.164.30.206]) by svr1.postgresql.org (Postfix) with ESMTP id EBB1E32A923 for ; Thu, 21 Oct 2004 19:59:10 +0100 (BST) Received: from localhost (xolinux73g2 [127.0.0.1]) by ezyield.com (8.12.5/8.11.6) with ESMTP id i9LLteH6022318 for ; Thu, 21 Oct 2004 14:55:40 -0700 Received: from ezyield.com ([127.0.0.1]) by localhost (mail.ezyield.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21753-06 for ; Thu, 21 Oct 2004 14:55:33 -0700 (PDT) Received: from KENTA (67.108.170.254.ptr.us.xo.net [67.108.170.254]) by ezyield.com (8.12.5/8.11.6) with SMTP id i9LLtKn5022264 for ; Thu, 21 Oct 2004 14:55:22 -0700 From: "Kent Anderson" To: "Pgsql-Sql@Postgresql. Org" Subject: Finding duplicated values Date: Thu, 21 Oct 2004 14:58:52 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0002_01C4B77E.7AC7C010" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new 20040701 at ezyield.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.5 tagged_above=0.0 required=5.0 tests=FORGED_MUA_OIMO, HTML_30_40, HTML_MESSAGE X-Spam-Level: *** X-Archive-Number: 200410/152 X-Sequence-Number: 19255 This is a multi-part message in MIME format. ------=_NextPart_000_0002_01C4B77E.7AC7C010 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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 ======================================== This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the "From:" field. ------=_NextPart_000_0002_01C4B77E.7AC7C010 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have a = few tables=20 that have duplicated values from an import from a different datab= ase.=20 I have two keys I tried to set as primary and got an error
ERROR:&nb= sp; could=20 not create unique index
DETAIL:  Table contains duplicated=20 values.
 
Is there = some join I=20 can use to compare the hmhmkey, wmwmkey pairs against the table to find=20 duplicate values? Each pair key should be unique but the old database was l= ess=20 than normalized.
 
I was trying to use = the code=20 below but it returned no rows.
 
SELECT hm= hmkey,=20 wmwmkey
FROM   exceptions
EXCEPT
SELECT hmhmkey, wmwmke= y=20
FROM = ;=20 exceptions;
 
Any=20 suggestions?
 
Kent Anderson
EZYield.com
407-629-0900
www.ezyield.com
 
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This electronic message transmission conta= ins=20 information from the Company that may be proprietary, confidential and/or= =20 privileged. The information is intended only for the use of the individual(= s) or=20 entity named above.  If you are not the intended recipient, be aware t= hat=20 any disclosure, copying or distribution or use of the contents of this=20 information is prohibited.  If you have received this electronic=20 transmission in error, please notify the sender immediately by replying to = the=20 address listed in the "From:" field.
 
------=_NextPart_000_0002_01C4B77E.7AC7C010--