From ezequias.rocha@gmail.com Fri Feb 2 13:49:11 2007 Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EB3C19FB25C for ; Fri, 2 Feb 2007 09:49:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 96183-01 for ; Fri, 2 Feb 2007 09:49:01 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by postgresql.org (Postfix) with ESMTP id DB38A9FA6B5 for ; Fri, 2 Feb 2007 09:49:00 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so679900ugf for ; Fri, 02 Feb 2007 05:48:59 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=CC65wKiwf5OdsZPivcDJNO/PPESNy8MLIAtMpuZ28LQL5qKD5CKFRfpDSCZ2H8BVhdGF1aZ1XVMnlRmqdafNmr+/BqH20flgFxBxmz8jpTp5HUhQCCGif6w060LZQTt4K0d8VwdJLGj20920ZGKnoG/VmfVDTIdxpBhufBOeKV0= Received: by 10.67.93.6 with SMTP id v6mr4447899ugl.1170424139255; Fri, 02 Feb 2007 05:48:59 -0800 (PST) Received: by 10.66.217.13 with HTTP; Fri, 2 Feb 2007 05:48:59 -0800 (PST) Message-ID: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> Date: Fri, 2 Feb 2007 11:48:59 -0200 From: "Ezequias Rodrigues da Rocha" To: pgsql-sql@postgresql.org Subject: Duplicate records MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_20638_29648301.1170424139212" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/10 X-Sequence-Number: 27344 ------=_Part_20638_29648301.1170424139212 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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. --=20 =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- A pior das democracias ainda =E9 melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/ ------=_Part_20638_29648301.1170424139212 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi list,

I am making some data minning and would like to know if som= eone tell me how to retrieve the duplicate records based in one or two fiel= ds of my table.

Any help would be welcomed.

--= =20
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
 &n= bsp;            = ;            &n= bsp;       Atenciosamente (Sincerely)            &n= bsp;           Ezequ= ias Rodrigues da Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-
A pior das democracias ainda =E9 melhor do que a melhor das ditadurasThe worst of democracies is still better than the better of dictatorships=
http://ezequiasrocha.blo= gspot.com/ ------=_Part_20638_29648301.1170424139212-- From mezei.zoltan@telefor.hu Fri Feb 2 14:29:36 2007 Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 3A3A59FB283 for ; Fri, 2 Feb 2007 10:29:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 26389-08 for ; Fri, 2 Feb 2007 10:29:27 -0400 (AST) X-Greylist: delayed 00:29:45.348397 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 7CA9F9FB1DD for ; Fri, 2 Feb 2007 10:29:32 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail.telefor.hu (mail.telefor.hu [193.68.53.97]) by svr4.postgresql.org (Postfix) with ESMTP id 31EC35AF89A for ; Fri, 2 Feb 2007 13:59:45 +0000 (GMT) Received: from telefor-server.int.telefor-new.hu (telefor-server.int.telefor-new.hu [10.0.20.100]) by mail.telefor.hu (Postfix) with ESMTP id D24A11C078; Fri, 2 Feb 2007 14:59:34 +0100 (CET) Received: from [10.0.20.33] ([10.0.20.33]) by telefor-server.int.telefor-new.hu with Microsoft SMTPSVC(6.0.3790.1830); Fri, 2 Feb 2007 14:54:40 +0100 Message-ID: <45C34290.2090300@telefor.hu> Date: Fri, 02 Feb 2007 14:54:24 +0100 From: =?ISO-8859-1?Q?Mezei_Zolt=E1n?= Organization: Telefor kft. User-Agent: Thunderbird 2.0b2 (Windows/20070116) MIME-Version: 1.0 To: Ezequias Rodrigues da Rocha Cc: pgsql-sql@postgresql.org Subject: Re: Duplicate records References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> In-Reply-To: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Feb 2007 13:54:40.0404 (UTC) FILETIME=[AF273540:01C746D1] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50 X-Spam-Level: X-Archive-Number: 200702/17 X-Sequence-Number: 27351 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 shoaibmir@gmail.com Fri Feb 2 13:55:20 2007 Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2E8609FB1BA for ; Fri, 2 Feb 2007 09:55:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 96908-02-2 for ; Fri, 2 Feb 2007 09:55:13 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.228]) by postgresql.org (Postfix) with ESMTP id 26FD79FB26A for ; Fri, 2 Feb 2007 09:55:12 -0400 (AST) Received: by nz-out-0506.google.com with SMTP id i11so832223nzh for ; Fri, 02 Feb 2007 05:55:11 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=HMOJSqy3h8Hgvvc8fM10LG4HG3mxhsBFGWzS/qREUEQEW6zt5/VnULXXkEnod2BWrNlwNprmo/P67NG3WMTsK6UF2Q8vDiAw5UHhPwof2daVAoknND7NGVqMxA4ILaxyrCkU3bK2YJnbYvQLuKGX94g5nwh9jxGX7RengrR6/As= Received: by 10.65.251.1 with SMTP id d1mr6076479qbs.1170424511296; Fri, 02 Feb 2007 05:55:11 -0800 (PST) Received: by 10.65.206.17 with HTTP; Fri, 2 Feb 2007 05:55:11 -0800 (PST) Message-ID: Date: Fri, 2 Feb 2007 18:55:11 +0500 From: "Shoaib Mir" To: "Ezequias Rodrigues da Rocha" Subject: Re: Duplicate records Cc: pgsql-sql@postgresql.org In-Reply-To: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15697_27417285.1170424511168" References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/12 X-Sequence-Number: 27346 ------=_Part_15697_27417285.1170424511168 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline That has been asked in the past a number of time too, you can look at the following for details --> http://archives.postgresql.org/pgsql-novice/2006-06/msg00093.php -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 2/2/07, 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. > > -- > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D > Atenciosamente (Sincerely) > Ezequias Rodrigues da Rocha > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- > A pior das democracias ainda =E9 melhor do que a melhor das ditaduras > The worst of democracies is still better than the better of dictatorships > http://ezequiasrocha.blogspot.com/ ------=_Part_15697_27417285.1170424511168 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline That has been asked in the past a number of time too, you can look at the f= ollowing for details --> http://archives.postgresql.org/pgsql-novice/2= 006-06/msg00093.php

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 2/2/07, Ezequias Rodrigues da Rocha = < ezequias.rocha@gmail.com>= ; wrote:
Hi= list,

I am making some data minning and would like to know if someone tel= l me how to retrieve the duplicate records based in one or two fields of my= table.

Any help would be welcomed.

--=20
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
 &n= bsp;            = ;            &n= bsp;       Atenciosamente (Sincerely)         &= nbsp;           &nbs= p;  Ezequias Rodrigues da Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
A pior das democracias ainda =E9 melhor do que a melhor das ditadurasThe worst of democracies is still better than the better of dictatorships=
http://ezequiasrocha.blogspot.com/

------=_Part_15697_27417285.1170424511168-- From Bart.Degryse@indicator.be Fri Feb 2 13:55:41 2007 Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6EE659FB26C for ; Fri, 2 Feb 2007 09:55:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 96908-03 for ; Fri, 2 Feb 2007 09:55:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 5AB149FB1BA for ; Fri, 2 Feb 2007 09:55:32 -0400 (AST) Received: from webaccess.indicator.be ([10.100.1.7]) by interscan.indicator.com with InterScan Message Security Suite; Fri, 02 Feb 2007 14:43:46 +0100 Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Fri, 02 Feb 2007 14:55:29 +0100 Message-Id: <45C350D8.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Fri, 02 Feb 2007 14:55:20 +0100 From: "Bart Degryse" To: "Ezequias Rodrigues da Rocha" , Subject: Re: Duplicate records References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> In-Reply-To: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part7450FFD8.1__=" X-imss-version: 2.046 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.11 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200702/13 X-Sequence-Number: 27347 --=__Part7450FFD8.1__= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit select * from mytable A, (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) B where A.field1 = B.field1 and A.field2 = B.field2 >>> "Ezequias Rodrigues da Rocha" 2007-02-02 14:48 >>> 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. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/ --=__Part7450FFD8.1__= Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Description: HTML
select *
from mytable A, (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) B
where A.field1 = B.field1 and A.field2 = B.field2

>>> "Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com> 2007-02-02 14:48 >>>
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.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                  Atenciosamente (Sincerely)
                        Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor d o que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/
--=__Part7450FFD8.1__=-- From ezequias.rocha@gmail.com Fri Feb 2 13:59:40 2007 Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C346C9FA42F for ; Fri, 2 Feb 2007 09:59:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 76184-09 for ; Fri, 2 Feb 2007 09:59:33 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id 268279FA410 for ; Fri, 2 Feb 2007 09:59:32 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so682121ugf for ; Fri, 02 Feb 2007 05:59:31 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=W2KfL29zWoM1cQIqB5zI/xupmQD5x8H/efxTi9oNv5horbAh/Nwdch7tWLFd1NmOeTKRDmM44tkdc074ZnMe85bux60PVedvG1gRUCypxcGPNy7BV8f3+D9SJWRzkCW9V9zb5tjNSj9Pc/idDjS71VKl8h1sT7BaYSxWOCMSBco= Received: by 10.82.153.5 with SMTP id a5mr1192317bue.1170424770755; Fri, 02 Feb 2007 05:59:30 -0800 (PST) Received: by 10.66.217.13 with HTTP; Fri, 2 Feb 2007 05:59:30 -0800 (PST) Message-ID: <55c095e90702020559t27296667g5a46aca1b5386679@mail.gmail.com> Date: Fri, 2 Feb 2007 11:59:30 -0200 From: "Ezequias Rodrigues da Rocha" To: "Bart Degryse" Subject: Re: Duplicate records Cc: pgsql-sql@postgresql.org In-Reply-To: <45C350D8.A3DD.0030.0@indicator.be> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_20770_28619766.1170424770595" References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> <45C350D8.A3DD.0030.0@indicator.be> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/14 X-Sequence-Number: 27348 ------=_Part_20770_28619766.1170424770595 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thank you but are you talking of two tables ? I intent to check in only one table. Please explain to me. Ezequias 2007/2/2, Bart Degryse : > > select * > from mytable A, (select field1, field2, count(*) from mytable group by > field1, field2 having count(*) > 1) B > where A.field1 =3D B.field1 and A.field2 =3D B.field2 > > >>> "Ezequias Rodrigues da Rocha" 2007-02-02 > 14:48 >>> > 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. > > -- > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D > Atenciosamente (Sincerely) > Ezequias Rodrigues da Rocha > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- > A pior das democracias ainda =E9 melhor do que a melhor das ditaduras > The worst of democracies is still better than the better of dictatorships > http://ezequiasrocha.blogspot.com/ > --=20 =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- A pior das democracias ainda =E9 melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/ ------=_Part_20770_28619766.1170424770595 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thank you but are you talking of two tables ? I intent to check in only one= table.

Please explain to me.

Ezequias

2007/2/2, Bart = Degryse < Bart.Degryse@indicator.be&= gt;:
select *
from mytable A, (select field1, field2, count(*) from mytable group by= field1, field2 having count(*) > 1) B
where A.field1 =3D B.field1 and A.field2 =3D B.field2

>>&= gt; "Ezequias Rodrigues da Rocha" < ezequias.rocha@gmail.com> 2007-02-02 14:48 >>>

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.

--
=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
    =             &nb= sp;            =      Atenciosamente (Sincerely)
  &nb= sp;            =          Ezequias Rodrigues da= Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- <= br>A pior das democracias ainda =E9 melhor do que a melhor das ditadurasThe worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blo= gspot.com/



--
=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
      = ;            &n= bsp;            = ;   Atenciosamente (Sincerely)
    &n= bsp;            = ;       Ezequias Rodrigues da Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -
A pior das democracias ainda =E9 melhor do que a melhor das ditaduras<= br>The worst of democracies is still better than the better of dictatorship= s
http://ezequiasrocha.blo= gspot.com/ ------=_Part_20770_28619766.1170424770595-- From shoaibmir@gmail.com Fri Feb 2 14:03:34 2007 Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D09369FA22A for ; Fri, 2 Feb 2007 10:03:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 98766-09 for ; Fri, 2 Feb 2007 10:03:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.235]) by postgresql.org (Postfix) with ESMTP id BE4529FA15F for ; Fri, 2 Feb 2007 10:03:10 -0400 (AST) Received: by nz-out-0506.google.com with SMTP id i11so834333nzh for ; Fri, 02 Feb 2007 06:03:09 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=akDUBVE+l9CC78qe7rZTRrWRL5DU/jahF7pfICnTEzxjPD92652jzrv07HdZxV179BMzjDlaylV42c3xVz8SkDSbfYW71MftGhnmSloj9jEfOyDIUqQGPxEvap92+woEVrk2kAQsGYxY0vNDDR2CXjvKZAM4ya0x1ihcdnUOKEI= Received: by 10.65.211.13 with SMTP id n13mr5963904qbq.1170424988781; Fri, 02 Feb 2007 06:03:08 -0800 (PST) Received: by 10.65.206.17 with HTTP; Fri, 2 Feb 2007 06:03:08 -0800 (PST) Message-ID: Date: Fri, 2 Feb 2007 19:03:08 +0500 From: "Shoaib Mir" To: "Ezequias Rodrigues da Rocha" Subject: Re: Duplicate records Cc: "Bart Degryse" , pgsql-sql@postgresql.org In-Reply-To: <55c095e90702020559t27296667g5a46aca1b5386679@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15841_23404504.1170424988729" References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> <45C350D8.A3DD.0030.0@indicator.be> <55c095e90702020559t27296667g5a46aca1b5386679@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/15 X-Sequence-Number: 27349 ------=_Part_15841_23404504.1170424988729 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Where do you see the second table in it? I guess here: A =3D mytable B =3D (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) So that is all around one table that is 'mytable', where A and B are just the aliases. -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 2/2/07, Ezequias Rodrigues da Rocha wrote: > > Thank you but are you talking of two tables ? I intent to check in only > one table. > > Please explain to me. > > Ezequias > > 2007/2/2, Bart Degryse < Bart.Degryse@indicator.be>: > > > > select * > > from mytable A, (select field1, field2, count(*) from mytable group by > > field1, field2 having count(*) > 1) B > > where A.field1 =3D B.field1 and A.field2 =3D B.field2 > > > > >>> "Ezequias Rodrigues da Rocha" < ezequias.rocha@gmail.com> 2007-02-0= 2 > > 14:48 >>> > > 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. > > > > -- > > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D > > Atenciosamente (Sincerely) > > Ezequias Rodrigues da Rocha > > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- > > > > A pior das democracias ainda =E9 melhor do que a melhor das ditaduras > > The worst of democracies is still better than the better of > > dictatorships > > http://ezequiasrocha.blogspot.com/ > > > > > > -- > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D > Atenciosamente (Sincerely) > Ezequias Rodrigues da Rocha > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- > A pior das democracias ainda =E9 melhor do que a melhor das ditaduras > The worst of democracies is still better than the better of dictatorships > http://ezequiasrocha.blogspot.com/ ------=_Part_15841_23404504.1170424988729 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Where do you see the second table in it?

I guess here:

A =3D = mytable
B =3D (select field1, field2, count(*) from mytable group by fie= ld1, field2 having count(*) > 1)

So that is all around one table = that is 'mytable', where A and B are just the aliases.

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On= 2/2/07, Ezequias Rodrigues da Rocha <= ezequias.rocha@gmail.com> wrote:
Thank you but are you talking of two tables ? = I intent to check in only one table.

Please explain to me.

Eze= quias

2007/2/2, Bart Degryse= < Bart.Degryse@indicator.be&= gt;:
select *
from mytable A, (select field1, field2, count(*) from mytable group by= field1, field2 having count(*) > 1) B
where A.field1 =3D B.field1 and A.field2 =3D B.field2

>>&= gt; "Ezequias Rodrigues da Rocha" < ezequias.rocha@gmail.com> 2007-02-02 14:48 >>>
Hi list,

I am making some data minning and would like to know if s= omeone tell me how to retrieve the duplicate records based in one or two fi= elds of my table.

Any help would be welcomed.

--
=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
    =             &nb= sp;            =      Atenciosamente (Sincerely)
  &nb= sp;            =          Ezequias Rodrigues da= Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- <= br>A pior das democracias ainda =E9 melhor do que a melhor das ditadurasThe worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blo= gspot.com/



--
=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
      = ;            &n= bsp;            = ;   Atenciosamente (Sincerely)
    &n= bsp;            = ;       Ezequias Rodrigues da Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -
A pior das democracias ainda =E9 melhor do que a melhor das ditaduras<= br>The worst of democracies is still better than the better of dictatorship= s
http://ezequiasrocha.blo= gspot.com/

------=_Part_15841_23404504.1170424988729-- From Bart.Degryse@indicator.be Fri Feb 2 14:13:34 2007 Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 58AED9FA4CD for ; Fri, 2 Feb 2007 10:13:34 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 01018-02 for ; Fri, 2 Feb 2007 10:13:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 434169FB1DC for ; Fri, 2 Feb 2007 10:13:24 -0400 (AST) Received: from webaccess.indicator.be ([10.100.1.7]) by interscan.indicator.com with InterScan Message Security Suite; Fri, 02 Feb 2007 15:01:39 +0100 Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Fri, 02 Feb 2007 15:13:22 +0100 Message-Id: <45C35506.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Fri, 02 Feb 2007 15:13:11 +0100 From: "Bart Degryse" To: "Ezequias Rodrigues da Rocha" , Subject: Re: Duplicate records References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com><45C 350D8.A3DD.0030.0@indicator.be><55c095e90702020559t27296667g5a46aca1b538667 9@mail.gmail.com> In-Reply-To: <55c095e90702020559t27296667g5a46aca1b5386679@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part4F6BC4E7.1__=" X-imss-version: 2.046 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.172 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200702/16 X-Sequence-Number: 27350 --=__Part4F6BC4E7.1__= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit The only table in my query is "mytable". The part (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) counts how many records have the same field1 and field2 and returns a record per combination of field1 and field2 that have more than one (= duplicates) The rest uses that information to filter all fields of all the records from that same table having such a combination of field1 and field2 This version is even a little shorter: select * from mytable A, (select field1, field2 from mytable group by field1, field2 having count(*) > 1) B where A.field1 = B.field1 and A.field2 = B.field2 >>> "Ezequias Rodrigues da Rocha" 2007-02-02 14:59 >>> Thank you but are you talking of two tables ? I intent to check in only one table. Please explain to me. Ezequias 2007/2/2, Bart Degryse < Bart.Degryse@indicator.be>: select * from mytable A, (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) B where A.field1 = B.field1 and A.field2 = B.field2 >>> "Ezequias Rodrigues da Rocha" 2007-02-02 14:48 >>> 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. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/ -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- A pior das democracias ainda é melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/ --=__Part4F6BC4E7.1__= Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Description: HTML
The only table in my query is "mytable".
The part (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1)
counts how many records have the same field1 and field2 and returns a record per combination of field1 and field2 that have more than one (= duplicates)
 
The rest uses that information to filter all fields of all the records from that same table having such a combination of field1 and field2
This version is even a little shorter:
select *
from mytable A, (select field1, field2 from mytable group by field1, field2 having count(*) > 1) B
where A.field1 = B.field1 and A.field2 = B.field2

>>> "Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com> 2007-02-02 14:59 >>>
Thank you but are you talking of two tables ? I intent to check in only one table.

Please explain to me.

Ezequias

2007/2/2, Bart Degryse < Bart.Degryse@indicator.be>:
select *
from mytable A, (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) B
where A.field1 = B.field1 and A.field2 = B.field2

>>> "Ezequias Rodrigues da Rocha" < ezequias.rocha@gmail.com> 2007-02-02 14:48 >>>

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.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                  Atenciosamente (Sincerely)
                        Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/



--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                  Atenciosamente (Sincerely)
                        Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogs pot.com/ --=__Part4F6BC4E7.1__=-- From ezequias.rocha@gmail.com Fri Feb 2 15:01:11 2007 Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 0CD3A9FA4CD for ; Fri, 2 Feb 2007 11:01:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 84761-10 for ; Fri, 2 Feb 2007 11:01:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.242]) by postgresql.org (Postfix) with ESMTP id A62D29FA15F for ; Fri, 2 Feb 2007 11:01:02 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c24so550980ana for ; Fri, 02 Feb 2007 07:01:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=ER5lVy6+qW2Ooxsgsat66pf6TzOmn+JfpuXbq4l7V09mKP2TiQlBJ/wBPgKwS94lgSV9f7FAnpSyTcRjRp9/wzwtTHRW+C0pmvYnZZTYWCbkQMAf7kRFH+NYwsGOfIEg4pXuhBbKuAqnaVB+8Fz3RXQCPjahrPfoSQcKKKhgtgU= Received: by 10.49.107.8 with SMTP id j8mr6621879nfm.1170428453809; Fri, 02 Feb 2007 07:00:53 -0800 (PST) Received: by 10.66.217.13 with HTTP; Fri, 2 Feb 2007 07:00:53 -0800 (PST) Message-ID: <55c095e90702020700v4e84c5e7n4e8116645c67a5af@mail.gmail.com> Date: Fri, 2 Feb 2007 13:00:53 -0200 From: "Ezequias Rodrigues da Rocha" To: "Shoaib Mir" Subject: Re: Duplicate records Cc: "Bart Degryse" , pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21958_10872689.1170428453297" References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> <45C350D8.A3DD.0030.0@indicator.be> <55c095e90702020559t27296667g5a46aca1b5386679@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL, BAYES_50, HTML_50_60, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200702/18 X-Sequence-Number: 27352 ------=_Part_21958_10872689.1170428453297 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline You are correct. Sorry my mistake. The SQL statement is correct and I find the duplicate records. ps: I just think postresql could make this easyly. Don't you think ? Any function or anything else. Thank you so much. Ezequias 2007/2/2, Shoaib Mir : > > Where do you see the second table in it? > > I guess here: > > A =3D mytable > B =3D (select field1, field2, count(*) from mytable group by field1, fiel= d2 > having count(*) > 1) > > So that is all around one table that is 'mytable', where A and B are just > the aliases. > > -- > Shoaib Mir > EnterpriseDB (www.enterprisedb.com) > > On 2/2/07, Ezequias Rodrigues da Rocha < ezequias.rocha@gmail.com> wrote: > > > > Thank you but are you talking of two tables ? I intent to check in only > > one table. > > > > Please explain to me. > > > > Ezequias > > > > 2007/2/2, Bart Degryse < Bart.Degryse@indicator.be>: > > > > > > select * > > > from mytable A, (select field1, field2, count(*) from mytable group b= y > > > field1, field2 having count(*) > 1) B > > > where A.field1 =3D B.field1 and A.field2 =3D B.field2 > > > > > > >>> "Ezequias Rodrigues da Rocha" < ezequias.rocha@gmail.com> > > > 2007-02-02 14:48 >>> > > > 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 o= f my > > > table. > > > > > > Any help would be welcomed. > > > > > > -- > > > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D > > > Atenciosamente (Sincerely) > > > Ezequias Rodrigues da Rocha > > > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= - > > > > > > A pior das democracias ainda =E9 melhor do que a melhor das ditaduras > > > The worst of democracies is still better than the better of > > > dictatorships > > > http://ezequiasrocha.blogspot.com/ > > > > > > > > > > > -- > > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D > > Atenciosamente (Sincerely) > > Ezequias Rodrigues da Rocha > > =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- > > A pior das democracias ainda =E9 melhor do que a melhor das ditaduras > > The worst of democracies is still better than the better of > > dictatorships > > http://ezequiasrocha.blogspot.com/ > > > --=20 =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- A pior das democracias ainda =E9 melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/ ------=_Part_21958_10872689.1170428453297 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline You are correct. Sorry my mistake. The SQL statement is correct and I find = the duplicate records.

ps:= I just think postresql could make this easyly. Don't you think ? Any f= unction or anything else.

Thank you so much.

Ezequias

2007/2/2, Shoaib Mir <shoaibmir@gmail.com >:
W= here do you see the second table in it?

I guess here:

A =3D m= ytable
B =3D (select field1, field2, count(*) from mytable group by field1, fi= eld2 having count(*) > 1)

So that is all around one table that is= 'mytable', where A and B are just the aliases.

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 2/2/07, E= zequias Rodrigues da Rocha < ezequias.rocha@gmail.com> wrote:
Thank you but are you talking of two tables ? = I intent to check in only one table.

Please explain to me.

Eze= quias

2007/2/2, Bart Degryse= < Bart.Degryse@indicator.be&= gt;:
select *
from mytable A, (select field1, field2, count(*) from mytable group by= field1, field2 having count(*) > 1) B
where A.field1 =3D B.field1 and A.field2 =3D B.field2

>>&= gt; "Ezequias Rodrigues da Rocha" < ezequias.rocha@gmail.com> 2007-02-02 14:48 >>>
Hi list,

I am making some data minning and would like to know if s= omeone tell me how to retrieve the duplicate records based in one or two fi= elds of my table.

Any help would be welcomed.

--
=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
    =             &nb= sp;            =      Atenciosamente (Sincerely)
  &nb= sp;            =          Ezequias Rodrigues da= Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- <= br>A pior das democracias ainda =E9 melhor do que a melhor das ditadurasThe worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blo= gspot.com/



--
=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
      = ;            &n= bsp;            = ;   Atenciosamente (Sincerely)
    &n= bsp;            = ;       Ezequias Rodrigues da Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -
A pior das democracias ainda =E9 melhor do que a melhor das ditaduras<= br>The worst of democracies is still better than the better of dictatorship= s
http://ezequiasrocha.blo= gspot.com/




--
=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D
    = ;            &n= bsp;            = ;     Atenciosamente (Sincerely)
  &n= bsp;            = ;         Ezequias Rodrigues d= a Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -
A pior das democracias ainda =E9 melhor do que a melhor das ditaduras<= br>The worst of democracies is still better than the better of dictatorship= s
http://ezequiasrocha.blo= gspot.com/ ------=_Part_21958_10872689.1170428453297-- From ajs@crankycanuck.ca Fri Feb 2 15:17:03 2007 Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 65E6E9FB1BA for ; Fri, 2 Feb 2007 11:17:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 91236-10 for ; Fri, 2 Feb 2007 11:16:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 418699FA22A for ; Fri, 2 Feb 2007 11:16:56 -0400 (AST) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1HD0L0-00086C-BZ for pgsql-sql@postgresql.org; Fri, 02 Feb 2007 10:28:30 -0500 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 8057B3FAF; Fri, 2 Feb 2007 10:16:44 -0500 (EST) Date: Fri, 2 Feb 2007 10:16:44 -0500 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: Duplicate records Message-ID: <20070202151644.GA11199@phlogiston.dyndns.org> References: <55c095e90702020548h4c5ae5b2h405a2a33fb5b950@mail.gmail.com> <45C350D8.A3DD.0030.0@indicator.be> <55c095e90702020559t27296667g5a46aca1b5386679@mail.gmail.com> <55c095e90702020700v4e84c5e7n4e8116645c67a5af@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55c095e90702020700v4e84c5e7n4e8116645c67a5af@mail.gmail.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/19 X-Sequence-Number: 27353 > > ps: I just think postresql could make this easyly. Don't you think ? Any > function or anything else. What's hard about the self-join? That's how SQL works. A -- Andrew Sullivan | ajs@crankycanuck.ca When my information changes, I alter my conclusions. What do you do sir? --attr. John Maynard Keynes