Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6EA8737C128 for ; Fri, 10 Oct 2008 08:07:41 -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 74254-06 for ; Fri, 10 Oct 2008 08:07:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fmailhost03.isp.att.net (fmailhost03.isp.att.net [207.115.11.53]) by postgresql.org (Postfix) with ESMTP id C2EB937C055 for ; Fri, 10 Oct 2008 08:07:29 -0300 (ADT) Received: from [127.0.0.1] (adsl-155-173-95.gsp.bellsouth.net[72.155.173.95]) by isp.att.net (frfwmhc03) with ESMTP id <20081010110723H030026sf9e>; Fri, 10 Oct 2008 11:07:24 +0000 X-Originating-IP: [72.155.173.95] Message-ID: <48EF376F.8050307@reedyriver.com> Date: Fri, 10 Oct 2008 07:07:27 -0400 From: "H. Hall" User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Jagadeesh , pgsql-admin@postgresql.org Subject: Re: can I update multiple table at a time? References: <4ba626d0-b2b5-4421-8df1-1bb39d4a858b@t39g2000prh.googlegroups.com> In-Reply-To: <4ba626d0-b2b5-4421-8df1-1bb39d4a858b@t39g2000prh.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.26 tagged_above=0 required=5 tests=WHOIS_DMNBYPROXY=0.26 X-Spam-Level: X-Archive-Number: 200810/82 X-Sequence-Number: 30538 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? > > Thanks > > Update a view using the rule system? See docs on rules: http://www.postgresql.org/docs/8.3/static/rules-update.html and this thread: http://forums.devshed.com/postgresql-help-21/rules-views-and-updating-multiple-tables-58288.html cheers, HH -- H. Hall ReedyRiver Group LLC http://www.reedyriver.com