Re: SQL - update table problem...

From: "Shoaib Mir" <shoaibmir(at)gmail(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: "Marko Rihtar" <riki_fox(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: SQL - update table problem...
Date: 2006-11-13 13:40:07
Message-ID: bf54be870611130540o1a565c4gddd6820d7b8f9d0d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You can try using a combination of a view and rule attached to it for
achieving the same...

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

On 11/13/06, Richard Huxton <dev(at)archonet(dot)com> wrote:
>
> Marko Rihtar wrote:
> > Hi,
> >
> > i'm trying to make update on multiple tables but don't know how.
> > is something like this posible with postgresql?
> >
> > update table1
> > join table2 on (table1.id=table2.t1)
> > join table3 on (table2.id=table3.t2)
> > set table1.name='test', table2.sum=table1.x+table2.y,
> > table3.cell='123456789'
> > where table1.id=6
>
> I don't know of an SQL variant to handle this case. Usually people are
> trying to update a single table based on joining to several others.
>
> In your case you'll have to issue three update statements wrapped in a
> transaction.
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message SunWuKung 2006-11-13 13:45:44 chop off non-meaningful digits
Previous Message Rick Schumeyer 2006-11-13 13:39:24 Re: encoding advice requested