Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 3E8F29FB1A5 for ; Wed, 17 Jan 2007 11:01:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 66001-08 for ; Wed, 17 Jan 2007 11:00:56 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.250]) by postgresql.org (Postfix) with ESMTP id B1DC19FB22C for ; Wed, 17 Jan 2007 11:01:01 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c24so1230323ana for ; Wed, 17 Jan 2007 07:01:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=DnpDpEEM8HMWeIefForYAbrlwne5oboES7LRX0Bub7LitRHImusrKPSBSkPE2ja54yImNBZSbFEjpqlD2EfQI3zYrjiDJqKy7CWhZV3U/RabwWImbOVwXKd/Et1Ep5O032CFhdIiHtVUJlcKVSaJLFtKHWPSqPS6PiEGDZfDKNU= Received: by 10.65.192.16 with SMTP id u16mr10175063qbp.1169046060351; Wed, 17 Jan 2007 07:01:00 -0800 (PST) Received: by 10.65.188.5 with HTTP; Wed, 17 Jan 2007 07:01:00 -0800 (PST) Message-ID: Date: Wed, 17 Jan 2007 20:01:00 +0500 From: "Shoaib Mir" To: "Andrew Sullivan" Subject: Re: Update query by joining multiple tables. Cc: pgsql-sql@postgresql.org In-Reply-To: <20070117125511.GC19527@phlogiston.dyndns.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_70919_3336007.1169046060224" References: <82e1a9bd0701170320j14d4ebdagd66d8c9f095b0192@mail.gmail.com> <20070117125511.GC19527@phlogiston.dyndns.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/71 X-Sequence-Number: 27223 ------=_Part_70919_3336007.1169046060224 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Might be a view and then a rule attached with that can help you out with doing updates using joins -------------- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/17/07, Andrew Sullivan wrote: > > On Wed, Jan 17, 2007 at 04:50:18PM +0530, Moiz Kothari wrote: > > http://www.postgresql.org/docs/8.1/interactive/sql-update.html, it is > not > > specified if a join can be done between multiple tables to update a > table, i > > Sure it is: > > A list of table expressions, allowing columns from other tables to > appear in the WHERE condition and the update expressions. > > a > > -- > Andrew Sullivan | ajs@crankycanuck.ca > Users never remark, "Wow, this software may be buggy and hard > to use, but at least there is a lot of code underneath." > --Damien Katz > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > ------=_Part_70919_3336007.1169046060224 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Might be a view and then a rule attached with that can help you out with doing updates using joins

--------------
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 1/17/07, Andrew Sullivan <ajs@crankycanuck.ca> wrote:
On Wed, Jan 17, 2007 at 04:50:18PM +0530, Moiz Kothari wrote:
> http://www.postgresql.org/docs/8.1/interactive/sql-update.html, it is not
> specified if a join can be done between multiple tables to update a table, i

Sure it is:

A list of table expressions, allowing columns from other tables to
appear in the WHERE condition and the update expressions.

a

--
Andrew Sullivan  | ajs@crankycanuck.ca
Users never remark, "Wow, this software may be buggy and hard
to use, but at least there is a lot of code underneath."
                --Damien Katz

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

------=_Part_70919_3336007.1169046060224--