From: | Mezei Zoltán <mezei(dot)zoltan(at)telefor(dot)hu> |
---|---|
To: | Ezequias Rodrigues da Rocha <ezequias(dot)rocha(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Duplicate records |
Date: | 2007-02-02 13:54:24 |
Message-ID: | 45C34290.2090300@telefor.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Shoaib Mir | 2007-02-02 13:55:11 | Re: Duplicate records |
Previous Message | Ezequias Rodrigues da Rocha | 2007-02-02 13:49:41 | Re: Insert into a date field |