Re: Beginner needs help - Mailing list pgsql-sql

From Greg Stark
Subject Re: Beginner needs help
Date
Msg-id 873cm7mwr4.fsf@stark.dyndns.tv
Whole thread Raw
In response to Beginner needs help  (Aaron Chu <astrate@mac.com>)
List pgsql-sql
Aaron Chu <astrate@mac.com> writes:

> 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.

SELECT surname FROM table GROUP BY surname HAVING count(*) > 1

More generally, read up on GROUP BY.

-- 
greg



pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Executing SQL commands via triggers without the use of
Next
From: "Victor Yegorov"
Date:
Subject: Re: Beginner needs help