X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9EEE9474E44 for ; Sat, 1 Mar 2003 03:41:17 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 25787-01 for ; Sat, 1 Mar 2003 03:41:16 -0500 (EST) Received: from shield.pirmabanka.lv (unknown [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id F3902474E42 for ; Sat, 1 Mar 2003 03:41:15 -0500 (EST) Received: from wall2.pirmabanka.lv (wall2-pub.pirmabanka.lv [195.114.57.14]) by shield.pirmabanka.lv (8.9.3/8.9.3) with SMTP id KAA26723 for ; Sat, 1 Mar 2003 10:41:16 +0200 Received: from share.pirmabanka.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Sat, 01 Mar 2003 10:41:15 +0200 (EET) Received: from pc311x1.pirmabanka.lv (IDENT:root@localhost.localdomain [127.0.0.1]) by pirmabanka.lv (8.11.5/8.11.5) with SMTP id h218fFo22531 for ; Sat, 1 Mar 2003 10:41:15 +0200 Received: (qmail 10936 invoked by uid 100); 1 Mar 2003 08:41:26 -0000 Date: Sat, 1 Mar 2003 10:41:26 +0200 From: "Victor Yegorov" To: pgsql-sql@postgresql.org Subject: Re: Beginner needs help Message-ID: <20030301084126.GB9377@pirmabanka.lv> Mail-Followup-To: pgsql-sql@postgresql.org References: <96853212-4AA9-11D7-8F7C-000393017462@mac.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9zSXsLTf0vkW971A" Content-Disposition: inline In-Reply-To: <96853212-4AA9-11D7-8F7C-000393017462@mac.com> User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/2 X-Sequence-Number: 12042 --9zSXsLTf0vkW971A Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Aaron Chu [01.03.2003 03:22]: > Hi, >=20 > I have a table which has a column of surnames (string) and I would like= =20 > to know how can I retrieve (SELECT) all the repeated surnames, i.e.=20 > more than one person who has the same surname. >=20 > Thanks. Say you have such a table: create table person ( name varchar(10) not null, surname varchar(20) not null ); =20=20=20=20=20=20=20=20 Now your select: select surname from person group by surname having count(surname) > 1; =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 --=20 Victor Yegorov --9zSXsLTf0vkW971A Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+YHI22RKGLEykUDYRAv1OAJ4u4bGC5/Bk01hBMP9P6ejlCWWzBgCgvU9B 2G8+DoCnOZgyMxgxLAqOWlU= =Bhb+ -----END PGP SIGNATURE----- --9zSXsLTf0vkW971A--