Subject Re: advice on mantaining a current account
Author Emil Totev
In a similar situation I am using a selectable stored procedure, which
calculates the current balance in an output variable.

Emil

--- In firebird-support@yahoogroups.com, "Sergio H. Gonzalez"
<shg_sistemas@...> wrote:
>
> Hi, I think this is a very old question, but I never did it with
Firebird
> before.
>
> I want to do a simpe current acount with in-out-balance columns. The
movements
> would come from the invoices and payments tables ordered by date. I
usually did
> it with triggers that insert the movements in a separate table and
re-calculate
> all the balances (with a stored procedure) for each record every
time something
> in inserted, modified or deleted. I wonder if there is a way to do
it "on the
> fly".. I mean when the user want to see some current account, just
do " select
> (some fields) from invoices union all select (some fields) from
payments order
> by 1" (being "1" the pos of the date field). Firts of all, I don't
know how fast
> would be this approach as the DB gets bigger, and second: I dont
know how to
> resolve the "balance" column on a select, because it depends on the
previous
> row. May I have some diferent opinions of experienced people?
Thanks!! -s
>