Re: Deleting duplicate records

Поиск
Список
Период
Сортировка
От Dmitry Tkach
Тема Re: Deleting duplicate records
Дата
Msg-id 3EDB618A.1080409@openratings.com
обсуждение исходный текст
Ответ на Deleting duplicate records  ("Bob Powell" <Bob@hotchkiss.org>)
Список pgsql-general
Bob Powell wrote:

>Hello everyone:
>
>Can someone tell me if there is a way to delete duplicate records from a table in Postgres.
>
>I once used a database management system that had a "Delete Duplicates" which would check every field in the row and
ifthey all matched would delete the row.  You could also designate the fields you wanted the command to use to check
fordups.  Very nice feature.  Maybe something for the TODO list?  
>
>
As generally as you state the problem, something like this comes to mind:

select distinct * into temp unique_rows from table_to_cleanup;
truncate table_to_cleanup;
insert into table_to_cleanup select * from unique_rows;

I hope, it helps...

Dima


>Bob Powell
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html
>
>



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

Предыдущее
От: "culley harrelson"
Дата:
Сообщение: installing contrib/tsearch with a FreeBSD Port
Следующее
От: "culley harrelson"
Дата:
Сообщение: installing contrib/tsearch with a FreeBSD Port