Попробуйте этот запрос:
declare @t1 table(ID int, ProjectName varchar(10), MachineTypeID int, MachineName varchar(5));
insert into @t1 values
(1, 'project1',1, 'm1'),
(1, 'project2',2, 'm2'),
(1, 'project1',2, 'm3'),
(1, 'project2',1, 'm4'),
(1, 'project1',2, 'm5');
declare @t2 table (Id int, Title varchar(20));
insert into @t2 values
(1, 'BigMachine'),
(2, 'SmallMachine');
select ProjectName,
max(case when MachineTypeId = 1 then cnt end) BigMachineCount,
max(case when MachineTypeId = 2 then cnt end) SmallMachineCount
from (
select ProjectName, MachineTypeId, count(*) cnt from @t1
group by ProjectName, MachineTypeId
) a group by ProjectName