Re: Delete duplicates - Mailing list pgsql-sql

From Rudi Starcevic
Subject Re: Delete duplicates
Date
Msg-id 3EF6928C.60705@oasis.net.au
Whole thread Raw
In response to Re: Delete duplicates  ("Denis Arh" <denis@exonium.net>)
List pgsql-sql
Hi,

Would this be OK or a little crude (untested) :

INSERT INTO new_table ( id, something )
SELECT
DISTINCT ON (id)
id,
something
FROM old_table
ORDER BY id

Or something similar but create a new table ?

Cheers
Rudi.




Denis Arh wrote:

>How to delete "real" duplicates?
>
>id | somthing
>-----------------------
>1 | aaa
>1 | aaa
>2 | bbb
>2 | bbb
>
>(an accident with backup recovery...)
>
>
>
>Regards,
>Denis Arh
>  
>



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Delete duplicates
Next
From: "Anagha Joshi"
Date:
Subject: Urgent Help : Use of return from function/procedure.