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

Re: duplicate records

From: Vassilis Papadimos <vpapad(at)cs(dot)pdx(dot)edu>
To: Thomas J Keller <kellert(at)ohsu(dot)edu>
Cc: pdxpug(at)postgresql(dot)org
Subject: Re: duplicate records
Date: 2006-10-18 22:24:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pdxpug
Thomas J Keller wrote:
> Excellent.
> So the first step is to create an empty table:
> passwords=# CREATE TABLE foo_bar LIKE original_table;
> ERROR:  syntax error at or near "LIKE" at character 22
> LINE 1: CREATE TABLE foo_bar LIKE original_table;

SQL doesn't have this "do what I mean" feature yet :-)


SELECT DISTINCT * FROM original_table INTO foobar;

This will create foobar with the same columns as original_table, and put 
all non-duplicate tuples from original_table in it.


In response to


pdxpug by date

Next:From: Vassilis PapadimosDate: 2006-10-18 22:48:44
Subject: Re: duplicate records
Previous:From: Thomas J KellerDate: 2006-10-18 22:16:23
Subject: Re: duplicate records

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