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: 4536A981.9080601@cs.pdx.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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 :-)

Try

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.

Vassilis.

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Vassilis Papadimos 2006-10-18 22:48:44 Re: duplicate records
Previous Message Thomas J Keller 2006-10-18 22:16:23 Re: duplicate records