I have table like HierarchyId EmployeeId ParentId ------------------------------------------------ 1 1 0 2 2 3 3 3 1 4 ...