Skip site navigation (1) Skip section navigation (2)

Re: can I update multiple table at a time?

From: Julius Tuskenis <julius(at)nsoft(dot)lt>
To: Jagadeesh <mnjagadeesh(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: can I update multiple table at a time?
Date: 2008-10-10 06:06:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
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

In response to


pgsql-admin by date

Next:From: JagadeeshDate: 2008-10-10 07:46:40
Subject: Re: how to invoke edtor?
Previous:From: Joshua DrakeDate: 2008-10-10 05:53:51
Subject: Re: can I update multiple table at a time?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group