dbTalk Databases Forums  

Copying

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Copying in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jake Stride
 
Posts: n/a

Default Copying - 09-10-2004 , 01:36 AM






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


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #2  
Old   
Michael Glaesemann
 
Posts: n/a

Default Re: Copying - 09-10-2004 , 01:58 AM







On Sep 10, 2004, at 3:36 PM, Jake Stride wrote:

Quote:
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


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.