X-Original-To: pgsql-sql@postgresql.org Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 0F0194758C9 for ; Sat, 8 Mar 2003 18:16:58 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id DE00643A945; Sat, 8 Mar 2003 18:16:57 -0500 (EST) From: =?ISO-8859-1?Q?Bj=F6rn?= Lundin X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Beginner needs help Date: Sun, 09 Mar 2003 00:20:57 +0100 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 14 Message-ID: References: <96853212-4AA9-11D7-8F7C-000393017462@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@news.hub.org User-Agent: KNode/0.7.1 To: pgsql-sql@postgresql.org X-Archive-Number: 200303/294 X-Sequence-Number: 12334 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. select surname, count('a') from table group by surname having count('a') > 1 order by surname /Björn