Skip site navigation (1) Skip section navigation (2)

Re: [Pdx-pm] duplicate records

From: Selena Deckelmann <selena(at)stereojoy(dot)com>
To: Thomas J Keller <kellert(at)ohsu(dot)edu>
Cc: pdx-pm-list-owner(at)pm(dot)org, pdxpug(at)postgresql(dot)org
Subject: Re: [Pdx-pm] duplicate records
Date: 2006-10-19 03:44:10
Message-ID: D23A706D-FE86-4046-9F48-64DC8ABB2307@stereojoy.com (view raw or flat)
Thread:
Lists: pdxpug
On Oct 18, 2006, at 6:17 PM, Thomas J Keller wrote:

> passwords=# INSERT INTO foobar (SELECT DISTINCT username,
> password,object,url_address,description,status FROM password);
> ERROR:  column "password_id" is of type integer but expression is of
> type character varying

something like this may work:

db=# create table newtable as (SELECT DISTINCT on (username)  
username, password, object, url_address,description, status from  
password);
db=# delete from password where 1>0;
db=# insert into password (username, password, object,  
url_address,description, status) SELECT * from newtable;

-selena



In response to

pdxpug by date

Next:From: Mark WongDate: 2006-10-19 22:21:30
Subject: authentication services
Previous:From: Devin Ben-HurDate: 2006-10-18 23:49:17
Subject: Re: duplicate records

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group