pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Aaron Chu <astrate@mac.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Beginner needs help
Date: Sun, 02 Mar 2003 19:00:55 +0100
Message-ID: <3E6246D7.8030804@klaster.net> (raw)
References: <96853212-4AA9-11D7-8F7C-000393017462@mac.com>

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





view thread (9+ messages)  latest in thread

Message-ID: <3E6246D7.8030804@klaster.net>
Permalink:  ../3E6246D7.8030804@klaster.net/
Also on:    postgresql.org/message-id/3E6246D7.8030804@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, astrate@mac.com
  Subject: Re: Beginner needs help
  In-Reply-To: <3E6246D7.8030804@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox