What do you really need? Is it a unique account number for an asset that has
several layers? A main account number containing a sub account number that
could contain further divisions. In that case, the asset needs a unique key
and should have secondary keys for the account, sub account and sub-sub
account.
I think Steve's suggestion is rather inflexible. What if you need more than
three levels? What if you want to reclassify an account as being somewhere
else in the hierarchy?
I would favour a structure something like this:
AccID (primary key)
AccName
AccParent (null for top-level accounts, otherwise the ID of the parent)
AccOrder (the numeric order that the account should be listed among its
siblings)
AccPostable (boolean - whether or not transactions may be posted to this
account [false for an account that is only a header])
Go with Graham's method. It is much better.
As Graham said, the other suggestion, although workable, is inflexible.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.