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 A01ACD1BA81 for ; Mon, 12 Jan 2004 09:46:09 +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 19540-03 for ; Mon, 12 Jan 2004 05:45:40 -0400 (AST) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 62C33D1BBB0 for ; Mon, 12 Jan 2004 05:45:32 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 1AfydT-000GbN-0Y; Mon, 12 Jan 2004 09:45:28 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id DC8BD16E2D; Mon, 12 Jan 2004 09:45:21 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 3C77C16DC9; Mon, 12 Jan 2004 09:45:19 +0000 (GMT) From: Richard Huxton To: beyaRecords - The home Urban music , pgsql-sql@postgresql.org Subject: Re: Select into Date: Mon, 12 Jan 2004 09:45:18 +0000 User-Agent: KMail/1.5 References: <010CB3A9-449C-11D8-9778-0003938366A4@beya-records.com> In-Reply-To: <010CB3A9-449C-11D8-9778-0003938366A4@beya-records.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401120945.18759.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/91 X-Sequence-Number: 16484 On Monday 12 January 2004 01:09, beyaRecords - The home Urban music wrote: > Hi, > I want to copy a sequence of rows from one table into another table. I > have tried select into but this will only work if the table you are > copying to does not already exist. How do I copy to a table that does > already exist? Something like: INSERT INTO table_a (a,b,c) SELECT d,e,f FROM table_b WHERE f=1; You could replace any of the columns in the SELECT by an expression if you wanted to. -- Richard Huxton Archonet Ltd