🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #379

Re: cumulative balance field

#379
From: Bill Todd [TeamB]
Date: Thu, 08 May 2008 00:18
16 lines
1581 bytes
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.

-- 
Bill Todd (TeamB)
Technical Details
Message-ID: <482246d0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4822380f@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
From: "Bill Todd [TeamB]" <no@no.com>
Subject: Re: cumulative balance field
Newsgroups: borland.public.interbase.sql
References: <4822380f@newsgroups.borland.com>
Organization: The Database Group, Inc.
User-Agent: XanaNews/1.18.1.9
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 65.118.176.23
Message-ID: <482246d0$1@newsgroups.borland.com>
Date: 7 May 2008 17:18:24 -0700
X-Trace: newsgroups.borland.com 1210205904 65.118.176.23 (7 May 2008 17:18:24 -0700)
Lines: 16
X-Authenticated-User: btodd
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 1414