X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0C455D1B519 for ; Tue, 13 Jan 2004 18:44:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 10981-01 for ; Tue, 13 Jan 2004 14:43:51 -0400 (AST) Received: from ndl1mr1-a-fixed.sancharnet.in (ndl1mr1-a-fixed.sancharnet.in [61.0.0.45]) by svr1.postgresql.org (Postfix) with ESMTP id B7A66D1D88D for ; Tue, 13 Jan 2004 14:43:49 -0400 (AST) Received: from conversion-daemon.ndl1mr1-a-fixed.sancharnet.in by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) id <0HRF00D01YNITV@ndl1mr1-a-fixed.sancharnet.in> for pgsql-sql@postgresql.org; Wed, 14 Jan 2004 00:13:49 +0530 (IST) Received: from sancharnet.in ([61.0.95.101]) by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) with ESMTPA id <0HRF00LXDYON9K@ndl1mr1-a-fixed.sancharnet.in>; Wed, 14 Jan 2004 00:13:49 +0530 (IST) Date: Wed, 14 Jan 2004 00:19:56 +0530 From: Sai Hertz And Control Systems Subject: Re: Copying rows between tables? In-reply-to: <1074011028.18994.18.camel@weaver.tuc.noao.edu> To: swampler@noao.edu Cc: Postgres-SQL Reply-To: aspire420@hotpop.com Message-id: <40043DD4.4090802@sancharnet.in> Organization: Sai Hertz And Control Systems MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 References: <1074011028.18994.18.camel@weaver.tuc.noao.edu> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/116 X-Sequence-Number: 16509 Dear Steve Wampler >I have an application where old records are archived into >'archive' tables. Occasionally there is a need to copy >some of these old records into the 'active' table. > > source_table(id: bigserial,uname: char,x1: char,x2: char,x3: char,x4: char) dest_table(id: bigserial,uname: char,x11: char,x21: char,x31: char,x41: char) you will do some thing like insert into dest_table(id,uname,x11,x21) (select id,uname,x1,x2 from source_table) Shootback if this helps Regards, Vishal Kashyap