Re: Beginner needs help

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Aaron Chu <astrate(at)mac(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Beginner needs help
Date: 2003-03-02 18:00:55
Message-ID: 3E6246D7.8030804@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-03-02 18:01:40 Re: default operator class (PostgreSQL's error?)
Previous Message Achilleus Mantzios 2003-03-02 16:04:17 Re: Dynamic SELECT condition