Received: from hariss.dnet.net.id (raphale.dnet.net.id [202.148.1.205] (may be forged)) by hub.org (8.9.3/8.9.3) with ESMTP id AAA24445 for ; Wed, 23 Jun 1999 00:40:16 -0400 (EDT) (envelope-from hariss@dnet.net.id) Received: from dnet.net.id (root@localhost [127.0.0.1]) by hariss.dnet.net.id (8.8.7/8.8.7) with ESMTP id LAA00489 for ; Wed, 23 Jun 1999 11:39:21 +0700 Sender: root@hariss.dnet.net.id Message-ID: <377064F8.88F0DFC@dnet.net.id> Date: Wed, 23 Jun 1999 04:39:21 +0000 From: Haris Susanto X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i586) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@hub.org Subject: insert on insert/update References: <199906220300.XAA07438@hub.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 !