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 !