Re: Beginner needs help - Mailing list pgsql-sql

From Tomasz Myrta
Subject Re: Beginner needs help
Date
Msg-id 3E6246D7.8030804@klaster.net
Whole thread Raw
In response to Beginner needs help  (Aaron Chu <astrate@mac.com>)
List 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




pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: default operator class (PostgreSQL's error?)
Next
From: "Zodiac"
Date:
Subject: Re: