pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFinding duplicated values
5+ messages / 5 participants
[nested] [flat]
* Finding duplicated values
@ 2004-10-21 18:58 Kent Anderson <kenta@ezyield.com>
2004-10-21 19:20 ` Re: Finding duplicated values Bricklen <bricklen@zyahoo.zcomz>
2004-10-21 20:09 ` Re: Finding duplicated values Stephan Szabo <sszabo@megazone.bigpanda.com>
2004-10-21 23:18 ` Re: Finding duplicated values lorid <lorid@dri.edu>
2004-10-22 07:49 ` Re: Finding duplicated values Christoph Haller <ch@rodos.fzk.de>
0 siblings, 4 replies; 5+ messages in thread
From: Kent Anderson @ 2004-10-21 18:58 UTC (permalink / raw)
To: pgsql-sql
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.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Finding duplicated values
2004-10-21 18:58 Finding duplicated values Kent Anderson <kenta@ezyield.com>
@ 2004-10-21 19:20 ` Bricklen <bricklen@zyahoo.zcomz>
3 siblings, 0 replies; 5+ messages in thread
From: Bricklen @ 2004-10-21 19:20 UTC (permalink / raw)
To: pgsql-sql
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 <http://www.ezyield.com/;
Try http://archives.postgresql.org/pgsql-sql/1999-03/msg00239.php
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Finding duplicated values
2004-10-21 18:58 Finding duplicated values Kent Anderson <kenta@ezyield.com>
@ 2004-10-21 20:09 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
3 siblings, 0 replies; 5+ messages in thread
From: Stephan Szabo @ 2004-10-21 20:09 UTC (permalink / raw)
To: Kent Anderson <kenta@ezyield.com>; +Cc: pgsql-sql
On Thu, 21 Oct 2004, 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.
Maybe
SELECT hmhmkey, wmwmkey
FROM exceptions
GROUP BY hmhmkey, wmwmkey
HAVING count(*)>1;
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Finding duplicated values
2004-10-21 18:58 Finding duplicated values Kent Anderson <kenta@ezyield.com>
@ 2004-10-21 23:18 ` lorid <lorid@dri.edu>
3 siblings, 0 replies; 5+ messages in thread
From: lorid @ 2004-10-21 23:18 UTC (permalink / raw)
To: Kent Anderson <kenta@ezyield.com>; +Cc: pgsql-sql
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 <http://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.
>
******************************
This might do it...
If you do this on the table that had duplicates you wont need to join
select count(hmhmkey),count(wmwmkey) from
exceptions group by hmhmkey,wmwmkey having count(hmhmkey) >1 or having
count(wmwmkey) >1;
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Finding duplicated values
2004-10-21 18:58 Finding duplicated values Kent Anderson <kenta@ezyield.com>
@ 2004-10-22 07:49 ` Christoph Haller <ch@rodos.fzk.de>
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Haller @ 2004-10-22 07:49 UTC (permalink / raw)
To: Kent Anderson <kenta@ezyield.com>; pgsql-sql
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
You might want to search the [SQL] archive on the following topics
for more inspiration:
selecting duplicate records
Delete 1 Record of 2 Duplicate Records
Regards, Christoph
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2004-10-22 07:49 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 18:58 Finding duplicated values Kent Anderson <kenta@ezyield.com>
2004-10-21 19:20 ` Bricklen <bricklen@zyahoo.zcomz>
2004-10-21 20:09 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
2004-10-21 23:18 ` lorid <lorid@dri.edu>
2004-10-22 07:49 ` Christoph Haller <ch@rodos.fzk.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox