From: | Erik Darling <edarling80(at)gmail(dot)com> |
---|---|
To: | Janek Sendrowski <janek12(at)web(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to delete completely duplicate rows |
Date: | 2014-01-01 12:41:21 |
Message-ID: | CAO+EYw+GTLwb8trWwDxVCJ2jU-CYPYANhUEppiO9NyD1LpW3pg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
With C as (
Select row_number() over partition by (list, all, columns, here order by
oid) as rn
)
Delete
From C
Where rn > 1;
On Jan 1, 2014 7:15 AM, "Janek Sendrowski" <janek12(at)web(dot)de> wrote:
> Hi,
>
> I want to delete duplicates in my table. I've dropped the unique
> constraint to insert my data.
> My id value is a hash calculated witch the values of the two other columns.
> So I want to delete all columns, which are indentical, but keeping one.
>
> DELETE FROM table t1 USING table t2 WHERE t1.id = t2.id AND t1.ctid >
> t2.ctid
>
> But the oids aren't unique enough.
> What else could I do?
>
> Janek
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jayadevan M | 2014-01-01 13:12:21 | Refresh Materialized View |
Previous Message | Janek Sendrowski | 2014-01-01 12:14:10 | How to delete completely duplicate rows |