Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Multiple Hierarchies

Author  Topic 

danielhai
Yak Posting Veteran

50 Posts

Posted - 2002-07-30 : 14:32:26
Here we go with the multiple Hierarchies again. Based off the SQL Team article, what I'm wanting to achieve is the ability for an Employee to have multiple Bosses. For instance:


tblEmployee

EmployeeID Name
1001 Denis Eaton-Hogg
1002 Bobbi Flekman
1003 Ian Faith
1004 David St. Hubbins
1005 Nigel Tufnel
1006 Derek Smalls

tblEmployeeBoss

EmployeeID BossID
1003 1001
1005 1001
1006 1001
1003 1002
1005 1002
1006 1002
1004 1003



I'm just very curious as to how to go about even thinking about how to query information like this ... ... any ideas?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-30 : 15:01:24
What specifically do you want to query for? Each person's boss? Each person's hierarchy?

The problem here is that a person's boss can themselves have more than one boss, so there's no direct way to represent a specific lineage...and there can be more than one path to follow, and no way to enforce a specific path.

You could potentially end up with a circular hierarchy too; a cyclic graph as Joe Celko discusses in SQL For Smarties.

Can you describe further exactly what you want to do? And if you're actual tables different from the article or your example, PLEASE POST THE ACTUAL DDL and some sample data.

Go to Top of Page
   

- Advertisement -