Thread: Copying

Copying

From
Jake Stride
Date:
Hi,

I have had a look at the docs but, correct me if I am wrong, cannot find a
way to select data into an existing table. I have looked at select into and
copy.

I have a table (called assests):

Id/name/jobno

Where id is a primary key/serial.

What I want to be able to do is:

SELECT name, 3 FROM assets <<INTO>> assets

Since id is a serial/has a default value you don't need to worry about it
(iei the database should take care of it).

Thanks

Jake


Re: Copying

From
Michael Glaesemann
Date:
On Sep 10, 2004, at 3:36 PM, Jake Stride wrote:

> What I want to be able to do is:
>
> SELECT name, 3 FROM assets <<INTO>> assets
>
> Since id is a serial/has a default value you don't need to worry about
> it
> (iei the database should take care of it).

I think what you want to do is something along the lines of

INSERT INTO assets (name, jobno)
    SELECT distinct name, 3
    FROM assets
;

Michael