X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 61DBC474E5C for ; Sun, 2 Mar 2003 13:09:01 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 30009-05 for ; Sun, 2 Mar 2003 13:08:59 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id F0A77474E42 for ; Sun, 2 Mar 2003 13:08:58 -0500 (EST) Received: from klaster.net (pc139.krakow.cvx.ppp.tpnet.pl [213.76.38.139]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 3C4EC2B896; Sun, 2 Mar 2003 19:07:32 +0100 (CET) Message-ID: <3E6246D7.8030804@klaster.net> Date: Sun, 02 Mar 2003 19:00:55 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.1) Gecko/20020826 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Aaron Chu Cc: pgsql-sql@postgresql.org Subject: Re: Beginner needs help References: <96853212-4AA9-11D7-8F7C-000393017462@mac.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/51 X-Sequence-Number: 12091 Aaron Chu wrote: >Hi, > >I have a table which has a column of surnames (string) and I would like >to know how can I retrieve (SELECT) all the repeated surnames, i.e. >more than one person who has the same surname. >Thanks. What exactly you want to do? To eliminate duplicates? Use then: select surname from users group by surname; Maybe you want to know which surnames are duplicated? Use then: select surname from users group by surname having count(*)>1 Regards, Tomasz Myrta