Re: Delete duplicates - Mailing list pgsql-sql

From Ian Barwick
Subject Re: Delete duplicates
Date
Msg-id 200306221220.15480.barwick@gmx.net
Whole thread Raw
In response to Delete duplicates  ("Rudi Starcevic" <rudi@oasis.net.au>)
List pgsql-sql
On Sunday 22 June 2003 11:15, Rudi Starcevic wrote:
> Hi,
>
> I have a table with duplicates and trouble with my SQL.

(...)

> select a1.id
> from aap a1
> where id < ( SELECT max(id) FROM aap AS a2 )
> AND EXISTS
> (
> SELECT *
> FROM aap AS a2
> WHERE a1.keyword = a2.keyword
> )

How about (untested):

SELECT a1.id FROM aap a1WHERE id = (SELECT MAX(id) FROM aap a2             WHERE a2.keyword = a1.keyword)


Ian Barwick
barwick@gmx.net




pgsql-sql by date:

Previous
From: "Rudi Starcevic"
Date:
Subject: Delete duplicates
Next
From: Paul Thomas
Date:
Subject: Re: Delete duplicates