From: | Jeremy Cowgar <develop(at)cowgar(dot)com> |
---|---|
To: | postgres list <pgsql-general(at)postgresql(dot)org> |
Subject: | How to get rid of dups... |
Date: | 2002-07-11 14:30:31 |
Message-ID: | 1026397832.1459.11.camel@laptop |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need to get rid of all rows that have dups in the columns
tpa,pun,grn,claim ... i.e.
1--- 001 001 001 00-000001 John Doe
2--- 001 001 001 00-000001 Jane Doe
3--- 001 002 001 00-000001 John Doe
1 and 2 would be dups, 1 and 3 are diff records, 2 and 3 are diff
records.
I tried this as a test:
select count(claimid), tpa, pun, grn, claim FROM claim_import GROUP BY
tpa, pun, grn, claim HAVING count(claimid) > 1;
26 rows returned.
then
select distinct on (tpa,pun,grn,claim) count(claimid), tpa, pun, grn,
claim FROM claim_import GROUP BY tpa, pun, grn, claim HAVING
count(claimid) > 1;
and still had 26 rows returned. not sure how that can happen.
Anyway, then I tried
CREATE UNIQUE INDEX tmpidx ON claim (tpa,pun,grn,claim);
that of course failed, stating dups existed.
Any help would be appreciated.
Thanks,
Jeremy
From | Date | Subject | |
---|---|---|---|
Next Message | Vivek Khera | 2002-07-11 15:09:14 | Re: was there a change in FreeBSD SHM implementation from |
Previous Message | Henrik Steffen | 2002-07-11 14:28:43 | Re: Serious Crash last Friday |