Re: Duplicate records - Mailing list pgsql-sql

From Mezei Zoltán
Subject Re: Duplicate records
Date
Msg-id 45C34290.2090300@telefor.hu
Whole thread Raw
In response to Duplicate records  ("Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com>)
List pgsql-sql
Ezequias Rodrigues da Rocha wrote:
> Hi list,
>
> I am making some data minning and would like to know if someone tell 
> me how to retrieve the duplicate records based in one or two fields of 
> my table.
>
> Any help would be welcomed.
You can use a simple query like this one:

select t1.id, t2.id
from table t1, table t2
where t1.record1 = t2.record1     and t1.record2 = t2.record2     and t1.id != t2.id

This one lists the ids of the matching records. You may need to fine 
tune it to your needs, e.g. use distinct or replace the != with <.

Zizi


pgsql-sql by date:

Previous
From: "Bart Degryse"
Date:
Subject: Re: Duplicate records
Next
From: "Ezequias Rodrigues da Rocha"
Date:
Subject: Re: Duplicate records