I've got a list of ledger account numbers. These numbers go like this:
- 5 (main account, #5)
- 501 (sub account of main account 5, #01)
- 50101 (sub account of this account, #01)
So if I have a list and want to order this by account number, then I'd like to create this order:
However, any ORDER BY will give me:
So what is the proper way of working with this kind of numbering? I imagine I can get another column for ordering, but I really prefer to use the account numbers as IDs that I use for ordering, as not to make things too complicated.