Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6A78037BEB5 for ; Fri, 10 Oct 2008 02:53:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 12504-08 for ; Fri, 10 Oct 2008 02:53:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lists.commandprompt.com (host-159.commandprompt.net [207.173.203.159]) by postgresql.org (Postfix) with ESMTP id 8052137BE97 for ; Fri, 10 Oct 2008 02:53:52 -0300 (ADT) Received: from jd-laptop (or-69-34-217-90.sta.embarqhsd.net [69.34.217.90]) (authenticated bits=0) by lists.commandprompt.com (8.13.8/8.13.8) with ESMTP id m9A5vfWV010140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Oct 2008 22:57:43 -0700 Date: Thu, 9 Oct 2008 22:53:51 -0700 From: Joshua Drake To: Jagadeesh Cc: pgsql-admin@postgresql.org Subject: Re: can I update multiple table at a time? Message-ID: <20081009225351.0ccdaa3b@jd-laptop> In-Reply-To: <4ba626d0-b2b5-4421-8df1-1bb39d4a858b@t39g2000prh.googlegroups.com> References: <4ba626d0-b2b5-4421-8df1-1bb39d4a858b@t39g2000prh.googlegroups.com> Organization: Command Prompt, Inc. X-Mailer: Claws Mail 3.6.0 (GTK+ 2.12.9; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (lists.commandprompt.com [207.173.203.159]); Thu, 09 Oct 2008 22:57:43 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/75 X-Sequence-Number: 30531 On Thu, 9 Oct 2008 22:12:04 -0700 (PDT) Jagadeesh wrote: > Hello Gurus, > > Is it possible to update two table using single sql statement? huh? > let me be clear > > I have table master with state and date field. And in history table I > have same fields i.e., state and date. I'm writing an update statement > to set 'open' state records to 'closed' state after 7. both table can > be joined using id. > > Any thoughts? Use a transaction? > > Thanks > -- The PostgreSQL Company since 1997: http://www.commandprompt.com/ PostgreSQL Community Conference: http://www.postgresqlconference.org/ United States PostgreSQL Association: http://www.postgresql.us/