Help with tree structure

I have some financial data for storage and management. Let me say that I have 2 departments, with offices in 2 cities, in two currencies and 4 bank accounts. (This is actually more complicated.) I want to show a list like this:

Electronics
    Chicago
        Dollars
            Account 2 -> transactions in acct2 in $ in chicago/electronics
        Euros
            Account 1 -> transactions in acct1 in E in chicago/electronics
            Account 3 -> etc.
            Account 4
    Brussles
        Dollars
            Account 1
        Euros
            Account 3
            Account 4
Dessert Toppings
    Chicago
        Dollars
            Account 1
            Account 4
        Euros
            Account 2
            Account 4
    Brussles
        Dollars
            Account 2
        Euros
            Account 3
            Account 4

Thus, at each level, except for the top one, a category can be displayed in several places. I read around about various methods, but none of the examples seem to refer to my specific use case, where nodes can appear in more than one place in the hierarchy. (Perhaps there is a different name for this than "tree" or "hierarchy.")

, - a > > "" "" - , , .

: , - . ( , ). , FWIW, php ms, , . ( .)

+3
2

? , -, .

, , City > Currency > Division? ?

: , , , Branch_ID, City_ID Currency_ID .

+1

, . MS SQL Server, , (CTE). , (, ). : http://www.mssqltips.com/tip.asp?tip=1520

!

0

Source: https://habr.com/ru/post/1737056/


All Articles