| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | Kent Anderson <kenta(at)ezyield(dot)com> |
| Cc: | "Pgsql-Sql(at)Postgresql(dot) Org" <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Finding duplicated values |
| Date: | 2004-10-21 20:09:50 |
| Message-ID: | 20041021130815.Y66555@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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;
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dmitry Tkach | 2004-10-21 22:44:23 | Trouble with explicit joins |
| Previous Message | Bricklen | 2004-10-21 19:20:42 | Re: Finding duplicated values |