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



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to