From: Victor Yegorov <viy@pirmabanka.lv>
To: pgsql-sql@postgresql.org
Subject: Re: Beginner needs help
Date: Sat, 1 Mar 2003 10:41:26 +0200
Message-ID: <20030301084126.GB9377@pirmabanka.lv> (raw)
In-Reply-To: <96853212-4AA9-11D7-8F7C-000393017462@mac.com>
References: <96853212-4AA9-11D7-8F7C-000393017462@mac.com>
* Aaron Chu <astrate@mac.com> [01.03.2003 03:22]:
> 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.
Say you have such a table:
create table person (
name varchar(10) not null,
surname varchar(20) not null
);
Now your select:
select
surname
from
person
group by surname
having count(surname) > 1;
--
Victor Yegorov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: viy@pirmabanka.lv
Subject: Re: Beginner needs help
In-Reply-To: <20030301084126.GB9377@pirmabanka.lv>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox