Re: Beginner needs help

From: "Victor Yegorov" <viy(at)pirmabanka(dot)lv>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Beginner needs help
Date: 2003-03-01 08:41:26
Message-ID: 20030301084126.GB9377@pirmabanka.lv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Aaron Chu <astrate(at)mac(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Aspire Something 2003-03-01 12:33:51 Arrays in Postgresql Processes
Previous Message Victor Yegorov 2003-03-01 08:37:30 Re: use of geometric types in select ?