X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9BA4232A1AF for ; Tue, 5 Oct 2004 21:21:29 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40169-05 for ; Tue, 5 Oct 2004 20:21:23 +0000 (GMT) Received: from mail1.baileylink.net (mail1.baileylink.net [12.152.112.20]) by svr1.postgresql.org (Postfix) with ESMTP id 20CF932A1AD for ; Tue, 5 Oct 2004 21:21:23 +0100 (BST) Received: from baileylink.net (nuernburg.baileylink.net [12.152.112.18]) by mail1.baileylink.net (You do not need to know.) with ESMTP id 721BB1C054; Tue, 5 Oct 2004 14:46:13 -0500 (CDT) Message-ID: <41630263.1080301@baileylink.net> Date: Tue, 05 Oct 2004 15:21:55 -0500 From: banghe User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mike Darretta Cc: pgsql-admin@postgresql.org Subject: Re: Migrating Data Between PG Tables References: <200410050159.i951xOH02113@candle.pha.pa.us> <41630082.4090802@metnet.navy.mil> In-Reply-To: <41630082.4090802@metnet.navy.mil> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS_SOCKS X-Spam-Level: * X-Archive-Number: 200410/94 X-Sequence-Number: 15087 One sql statement can solve this: sql> isnert into table_b (id, name, summary) select id, name, desc from table_a; Banghe Mike Darretta wrote: > Does anyone have a suggestion on the best way to migrate data between > two slightly different tables? For example: > > Table A > -------- > id : integer > name : string > desc : string > > > Table B > -------- > id : integer > name : string > date : date > summary : string > > In this example, I would like to copy all the data from Table A into > B, using the desc column to populate the summary column. > > Thanks, > Mike > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >