Subject | Re: [firebird-support] Best table structure for Debit/Credit |
---|---|
Author | Milan Babuskov |
Post date | 2006-06-19T16:49:11Z |
Alan.Davies@... wrote:
(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
http://swoes.blogspot.com/
http://www.flamerobin.org
> Generally one field for the amount and another to identify the type ofI have to say that I disagree with you and agree with other Alan
> transaction is best.
(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
http://swoes.blogspot.com/
http://www.flamerobin.org