how to look for duplicate rows?

From: zach cruise <zachc1980(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how to look for duplicate rows?
Date: 2010-01-29 16:40:51
Message-ID: bcdac0e81001290840p7384c76dkb918e1527cb7f093@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

i have to clean a table that looks like so:

create table test (sn integer, fname varchar(10), lname varchar(10));
insert into test values (1, 'adam', 'lambert');
insert into test values (2, 'john', 'mayer');
insert into test values (3, 'john', 'mayer');
insert into test values (4, 'mary', 'kay');
insert into test values (5, 'john', 'mayer');
insert into test values (6, 'susan', 'boyle');
insert into test values (7, 'susan', 'boyle');
insert into test values (8, 'mark', 'ingram');

for that, i need to run a query that returns like so:

result:
is_not_distinct
2, 3, 5
6, 7

using 8.1.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2010-01-29 16:44:20 Re: [GENERAL] Versions RSS page is missing version(s)
Previous Message Devrim GÜNDÜZ 2010-01-29 15:49:43 Re: [GENERAL] Versions RSS page is missing version(s)