Subject Re: [firebird-support] Best table structure for Debit/Credit
Author Milan Babuskov
Alan.Davies@... wrote:
> Generally one field for the amount and another to identify the type of
> transaction is best.

I have to say that I disagree with you and agree with other Alan
(McDonald). Your approach needs complicated selects. Having a field to
identify the type of transaction doesn't give any benefit and indexing
it would be useless. OTOH index on value > 0 and value < 0 should be
quite fast.

Having two separate columns is also good when you need to SUM() as it is
very simple, while in your case it would get even more complicated as
you have to multiply all the "credit" records by -1.

Milan Babuskov