Re: Beginner needs help - Mailing list pgsql-sql

From Lee Harr
Subject Re: Beginner needs help
Date
Msg-id b4gg03$t5p$1@news.hub.org
Whole thread Raw
In response to Beginner needs help  (Aaron Chu <astrate@mac.com>)
List pgsql-sql
In article <b4dtl8$1ejl$1@news.hub.org>, Björn Lundin wrote:
> 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.
> 
> select surname, count('a') from table
> group by surname
> having count('a') > 1
> order by surname
> 


SELECT DISTINCT surname FROM table t1, table t2 WHERE t1.surname = t2.surname   AND t1.oid != t2.oid
ORDER BY surname;



pgsql-sql by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: Execution plan Question
Next
From: "mark carew"
Date:
Subject: Re: Insert multiple Rows