Re: remote duplicate rows

From: ljb <ljb220(at)mindspring(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: remote duplicate rows
Date: 2006-09-14 00:36:39
Message-ID: eea86m$ojo$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

junkone1(at)gmail(dot)com wrote:
> hI
> i have a bad situation that i did not have primary key. so i have a
> table like this
> colname1 colname2
> 1 apple
> 1 apple
> 2 orange
> 2 orange
>
> It is a very large table. how do i remove the duplctes quickly annd
> without much change.

Make a new table (with a primary key) and the same columns in order,
and do: INSERT INTO newtable SELECT DISTINCT * FROM oldtable;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message J S B 2006-09-14 00:40:24 Re: berkley sockets
Previous Message Don Parris 2006-09-13 23:27:09 Re: [GENERAL] Question About Aggregate Functions