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.
Author |
Topic |
desai.piyush
Starting Member
1 Post |
Posted - 2008-08-08 : 20:40:41
|
HiI am little new to those kind of query. Need help. I have one table where it has got user manager relationship.Fields are like: EmployeeID, EmployeeName, ManagerIDNow, Each user has its one Manager. I need total count like each manager has how many employees under him. For example employee AA has three employee AA1, AA2, AA3. Now AA1 and AA2 are both manager and under both of them there are 2 employee. So, now I need total count under AA - and it should be 7. And this releation could go like n number of time like Its like tree view.Manager (10) - Employee - Employee - Manager (7) - Employee - Manager (5) - Manager (2) - Employee - Employee - Employee - EmployeeIf I get for one root manager, I can manage rest.Thanks in advance... for the help. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-09 : 02:01:46
|
You can create a function like this and use ithttp://support.microsoft.com/kb/248915 |
 |
|
|
|
|