Article View: borland.public.interbase.sql
Article #380Re: cumulative balance field
From: Isaac
Date: Thu, 08 May 2008 15:37
Date: Thu, 08 May 2008 15:37
21 lines
1790 bytes
1790 bytes
Bill Todd [TeamB] wrote: > Isaac wrote: > >> Hello, >> I have a table to store cash reigstery data for example: >> acc_id, date, name, debit, credit and balance >> >> I need the field "balance" to has the cumulative sum of the debit and >> the credit fields, how I create the field "balance" to display this >> information automatically ?? > > Use a before insert trigger to calculate the balance using the balance > from the prior row and the debit & credit numbers from the new row. I > assume that the amounts in these records can never be changed. > Hi Bill, In fact debit and credit fields can be changed by user at any time, I think I will need another trigger ? plz post any short examples of triggers I did not use them before Thanks
Technical Details
Message-ID:
<48231e5b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4822380f@newsgroups.borland.com> <482246d0$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,7fe0f2b0b1ac1758 X-Google-Attributes: gid114a0e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 08 May 2008 18:37:56 +0300 From: Isaac <no@no.com> User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 Newsgroups: borland.public.interbase.sql Subject: Re: cumulative balance field References: <4822380f@newsgroups.borland.com> <482246d0$1@newsgroups.borland.com> In-Reply-To: <482246d0$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 41.234.201.151 Message-ID: <48231e5b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1210261083 41.234.201.151 (8 May 2008 08:38:03 -0700) Lines: 21 Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!feeder.news-service.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail