Search Postgresql Archives

Deleting duplicate rows using ctid ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a table with 4 columns, none of them unique.  I want to delete all but one of the duplicate records.  I think there's a way to do this with ctid.  Examples that pop up in google searches always rely on something like a unique (id) field, like a primary key,  (no good in my case)

create table dog (variety varchar, name varchar, color varchar, age int);
insert into dogs 
  ('lab','moby','white',12),
  ('lab','moby','white',12),
  ('spaniel','max','black',13),
  ('spaniel','max','black'),13,
  ('lab','moby','white',12);

I want the result to be just 2 recs, one for each dog.






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux