Tiered Organisation

NathanSavidge

Registered User.
Local time
Today, 18:08
Joined
Apr 19, 2010
Messages
12
Hi,

Does anyone know a good place to look for SQL/Table structure to set up a tiered organisation structure. My table is as follows Team_ID, Sub_Team_Parent

So with

1 0
2 1
3 2
4 0
5 1

I would like to see (thrown 5 in there as almost there, but this is where it fails with entries like team 5) using sub queries


1
<TAB><TAB>2
<TAB><TAB><TAB><TAB>3
<TAB><TAB>5
4

Thanks
 
you could setup a function to multiple the value (times 2) and insert that many tabs in the front of whatever it is you have.
So basically:
Function AddTabs(MyValue) as String
Dim LpIt integer
AddTabs = ""
If MyValue = 0 then
exit function
End If
For LpIt = 1 to MyValue
AddTabs = AddTabs & vbTab & vbTab
Next LpIt
Exit Function
 
I don't understand what the <TABS> are for but if you want to represent the tiered structure then you could consider having all tiers in the same table and references to the parent and child in each record where appropriate.

This way, any record can have an infinite number of children and parents although in real life that would be horrendous.

So...

ID,ChildID,ParentID

would be a starting point.

Am I barking up the wrong tree?
 
Hi,

Does anyone know a good place to look for SQL/Table structure to set up a tiered organisation structure. My table is as follows Team_ID, Sub_Team_Parent

So with

1 0
2 1
3 2
4 0
5 1

I would like to see (thrown 5 in there as almost there, but this is where it fails with entries like team 5) using sub queries


1
<TAB><TAB>2
<TAB><TAB><TAB><TAB>3
<TAB><TAB>5
4

Thanks

See if this example helps:

TreeView Control Displaying Hierarchical Data (Supervisor
 

Users who are viewing this thread

Back
Top Bottom