From: Haris Susanto <hariss@dnet.net.id>
To: pgsql-sql@hub.org
Subject: insert on insert/update
Date: Wed, 23 Jun 1999 04:39:21 +0000
Message-ID: <377064F8.88F0DFC@dnet.net.id> (raw)
References: <199906220300.XAA07438@hub.org>
Help me, I have problem to solve the following case :
I have two tables with structure like these :
table_a
date id type amount
---------------------------------
01/06/99 01 a 200 (1)
01/06/99 02 a 900 (2)
05/06/99 01 b 300 (3)
01/07/99 01 a 500 (4)
table_b
date id balance
------------------------
01/06/99 01 -200 (A)
01/06/99 02 -900 (B)
05/06/99 01 100 (C)
01/07/99 01 -400 (D)
Everytime I insert a record into table_a or update the value of amount of a record, automatically
postgres insert a record into table_b.
For exampe if I insert a record (4)
Then the value of (D) :
table_b.date same as table_a.date
table_b.id same as table_a.id
table_b.balance = -200 + 300 + (-500)
Would somebody please tell me how to make it happen ?
Thanks a lot !
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: hariss@dnet.net.id, pgsql-sql@hub.org
Subject: Re: insert on insert/update
In-Reply-To: <377064F8.88F0DFC@dnet.net.id>
References: <199906220300.XAA07438@hub.org> <377064F8.88F0DFC@dnet.net.id>
* 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