Removing duplicates

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Removing duplicates
Дата
Msg-id 20050208205243.GA23077@wolff.to
обсуждение исходный текст
Ответ на  ("Surabhi Ahuja " <surabhi.ahuja@iiitb.ac.in>)
Список pgsql-general
Please use a relevant subject for your posts.

On Tue, Feb 08, 2005 at 23:14:57 +0530,
  Surabhi Ahuja  <surabhi.ahuja@iiitb.ac.in> wrote:
> i have a table in which duplicate rows occur.
>
> now i have to remove the duplicates. Please note that however, only the duplicate rows have to be deleted and not the
originalone. 
>
> How do i do it?

If the table has oids, then you can delete all but the row with the minimum
oid for each set of duplicates.

Another option is to do a select distinct into a temp table, a delete and
then copy the temp table back.

You should also add a constraint so that duplicates can't get back into
the table once you have it cleaned up.

В списке pgsql-general по дате отправления:

Предыдущее
От: awitney@sghms.ac.uk
Дата:
Сообщение: hi
Следующее
От: CSN
Дата:
Сообщение: Netstat - Lots of PG Connections