I have 2 tables : T_Employees and T_Projects
Every project has different number of employees assigned. What i need to do, is to get hierarchical structure of each employ
Your result datasets can be get running this query:
declare @project int ;
declare cur_project cursor for
select distinct ProjectId from T_Projects;
open cur_project
fetch next from cur_project into @project
while @@FETCH_STATUS = 0
begin
select E.* from [dbo].[T_Projects] P
inner join [dbo].[T_Employees] E
on P.EmployeeId = E.ID
where P.ProjectId = @project
fetch next from cur_project into @project
end
close cur_project;
deallocate cur_project;