>Hi all,
>
>I have run into a tough problem that perhaps someone else has run into or where conceptually they have done something similar.
>
>The table is of insurance company names. From the beginning the client said that there would be head offices and then branch offices. And the branch offices can also have branches etc. And the companies can be named differently (different operating companies). And the client would like to just see all the companies in one table for browsing. So I set up the table to have a pointer back to a parent company. It has worked well over the years (and no arguing over the design at this point - it has worked...although I might be open to a new design in the future if they move to a new backend).
>
>Here is the table example:
>
>Company_ID ParentCoID CompanyName City etc
>
>7684 0 Intact Insurance Toronto
>7685 7684 Intact Insurance Waterloo
>etc.
>
If you can do a topological sort (
https://en.wikipedia.org/wiki/Topological_sorting ) then it means that you have no cycles
Gregory