我想创建一个视图以显示该部门的部门名称,员工数,总薪水和项目数
这是我的查询,但没有返回数据:
SELECT d.[DeprtmentName] ,
count(e.[Id]) AS Employees,
sum(e.[Salary]) AS [Total Salary],
count(p.[Id]) AS Pojects
FROM [dbo].[Department] as d
join [dbo].[Employee] as e on d.id = e.[DeptId]
join [dbo].[ProjectEmployee] as p on e.id = p.[EmployeeId]
join [dbo].[Project] on p.[ProjectId] = [dbo].[Project].[Id]
group by (d.[DeprtmentName])