1: 2: 3: 4: 5: 6: 7:
select s.Name , sum(case when t.ProjectID = 1 then t.Time end ) Project1 , sum(case when t.ProjectID = 2 then t.Time end ) Project2 from StaffNames s left join Timesheet t on t.StaffID = s.StaffID group by s.Name