From: Julius Tuskenis <julius@nsoft.lt>
To: Jagadeesh <mnjagadeesh@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: can I update multiple table at a time?
Date: Fri, 10 Oct 2008 09:06:18 +0300
Message-ID: <48EEF0DA.7040806@nsoft.lt> (raw)
In-Reply-To: <4ba626d0-b2b5-4421-8df1-1bb39d4a858b@t39g2000prh.googlegroups.com>
References: <4ba626d0-b2b5-4421-8df1-1bb39d4a858b@t39g2000prh.googlegroups.com>
Hi, Jagadeesh
I would suggest you 2 solutions:
1. to use a function to edit these fields. That way you will be sure
that you will not forget to update both tables.
2. use a trigger on master table. If I understand you - the history
table could be filled using trigger, when data in master table changes.
That way you could change only master table in your application.
Good luck!
Jagadeesh rašė:
> 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
>
>
--
Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: julius@nsoft.lt, mnjagadeesh@gmail.com
Subject: Re: can I update multiple table at a time?
In-Reply-To: <48EEF0DA.7040806@nsoft.lt>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox