Re: Removing duplicate rows in table

Поиск
Список
Период
Сортировка
От Christophe Pettus
Тема Re: Removing duplicate rows in table
Дата
Msg-id 2E60FD03-E5D9-42D6-A080-690A378AF862@thebuild.com
обсуждение исходный текст
Ответ на Removing duplicate rows in table  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Removing duplicate rows in table
Список pgsql-general
If you don't mind taking the time to swap tables, you can always do an INSERT ... SELECT DISTINCT <fields> into a new
table,and then swap it with the existing table. 


> On Sep 10, 2024, at 08:07, Rich Shepard <rshepard@appl-ecosys.com> wrote:
>
> I've no idea how I entered multiple, identical rows in a table but I want to
> delete all but one of these rows.
>
> Here's an example:
>
> bustrac=# select * from projects where proj_nbr = '4242.01';
> proj_nbr |   proj_name    | start_date |  end_date  |  description  | notes
----------+----------------+------------+------------+---------------+-------
> 4242.01  | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy |
> 4242.01  | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy |
> 4242.01  | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy |
> 4242.01  | Expert witness | 2008-10-15 | 2008-10-28 | Consol Energy | (4 rows)
>
> How do I clean this up so there's only a single row for this project number?
>
> TIA,
>
> Rich
>
>




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