sql server - Determine the hierarchy of records in a SQL database -
I am getting a problem, I was wondering if there is a beautiful solution, this is a real business problem and class assignment is not!
I have thousands of records, some of which are related to each other
The database is SQL 2005.
The ID is the primary key if the record has changed an earlier record, then the ID of that record is in the REP_ID column.
ID REP_ID EDDBCBBAA NULL
Then in this example, the A was the original line, B place A, C replacement B failed, D replacement B. successfully and finally E in place of D.
I want to be able to display all records in this table in a grid. Then, I want the user to be able to click on any record in any group, and to find the system in all related records and to display in any type of tree.
Now I am obviously able to do this to solve the overwhelming force, but I would like to ask the community whether they can see a more elegant answer. Use one to create your hierarchy, some things like #TestValue ('E', & quot;
Comments
Post a Comment